| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867 |
- // GENERATED FILE - DO NOT EDIT.
- // Generated by generate_tests.py
- //
- // Copyright (c) 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.
- #include "../diff_test_utils.h"
- #include "gtest/gtest.h"
- namespace spvtools {
- namespace diff {
- namespace {
- // Test where src has an extra if block in one function, and dst has an extra
- // if block in another function.
- constexpr char kSrc[] = R"( OpCapability Shader
- %1 = OpExtInstImport "GLSL.std.450"
- OpMemoryModel Logical GLSL450
- OpEntryPoint Fragment %4 "main" %63 %68
- OpExecutionMode %4 OriginUpperLeft
- OpSource ESSL 310
- OpName %4 "main"
- OpName %8 "f1("
- OpName %10 "f2("
- OpName %13 "v"
- OpName %16 "Buffer"
- OpMemberName %16 0 "flag1"
- OpMemberName %16 1 "flag2"
- OpName %18 ""
- OpName %45 "v"
- OpName %63 "color"
- OpName %68 "v"
- OpDecorate %8 RelaxedPrecision
- OpDecorate %10 RelaxedPrecision
- OpDecorate %13 RelaxedPrecision
- OpMemberDecorate %16 0 RelaxedPrecision
- OpMemberDecorate %16 0 Offset 0
- OpMemberDecorate %16 1 RelaxedPrecision
- OpMemberDecorate %16 1 Offset 4
- OpDecorate %16 Block
- OpDecorate %18 DescriptorSet 0
- OpDecorate %18 Binding 0
- OpDecorate %23 RelaxedPrecision
- OpDecorate %30 RelaxedPrecision
- OpDecorate %31 RelaxedPrecision
- OpDecorate %34 RelaxedPrecision
- OpDecorate %35 RelaxedPrecision
- OpDecorate %36 RelaxedPrecision
- OpDecorate %37 RelaxedPrecision
- OpDecorate %38 RelaxedPrecision
- OpDecorate %39 RelaxedPrecision
- OpDecorate %40 RelaxedPrecision
- OpDecorate %41 RelaxedPrecision
- OpDecorate %42 RelaxedPrecision
- OpDecorate %45 RelaxedPrecision
- OpDecorate %47 RelaxedPrecision
- OpDecorate %48 RelaxedPrecision
- OpDecorate %50 RelaxedPrecision
- OpDecorate %51 RelaxedPrecision
- OpDecorate %54 RelaxedPrecision
- OpDecorate %55 RelaxedPrecision
- OpDecorate %56 RelaxedPrecision
- OpDecorate %57 RelaxedPrecision
- OpDecorate %58 RelaxedPrecision
- OpDecorate %63 RelaxedPrecision
- OpDecorate %63 Location 0
- OpDecorate %64 RelaxedPrecision
- OpDecorate %65 RelaxedPrecision
- OpDecorate %66 RelaxedPrecision
- OpDecorate %68 RelaxedPrecision
- OpDecorate %68 Location 0
- %2 = OpTypeVoid
- %3 = OpTypeFunction %2
- %6 = OpTypeFloat 32
- %7 = OpTypeFunction %6
- %12 = OpTypePointer Function %6
- %14 = OpConstant %6 0
- %15 = OpTypeInt 32 0
- %16 = OpTypeStruct %15 %15
- %17 = OpTypePointer Uniform %16
- %18 = OpVariable %17 Uniform
- %19 = OpTypeInt 32 1
- %20 = OpConstant %19 0
- %21 = OpTypePointer Uniform %15
- %24 = OpConstant %15 0
- %25 = OpTypeBool
- %29 = OpConstant %6 1
- %32 = OpConstant %19 1
- %49 = OpConstant %6 10
- %52 = OpConstant %6 0.5
- %53 = OpConstant %6 0.699999988
- %61 = OpTypeVector %6 4
- %62 = OpTypePointer Output %61
- %63 = OpVariable %62 Output
- %67 = OpTypePointer Input %6
- %68 = OpVariable %67 Input
- %4 = OpFunction %2 None %3
- %5 = OpLabel
- %64 = OpFunctionCall %6 %8
- %65 = OpFunctionCall %6 %10
- %66 = OpCompositeConstruct %61 %64 %65 %14 %29
- OpStore %63 %66
- OpReturn
- OpFunctionEnd
- %8 = OpFunction %6 None %7
- %9 = OpLabel
- %13 = OpVariable %12 Function
- OpStore %13 %14
- %22 = OpAccessChain %21 %18 %20
- %23 = OpLoad %15 %22
- %26 = OpINotEqual %25 %23 %24
- OpSelectionMerge %28 None
- OpBranchConditional %26 %27 %28
- %27 = OpLabel
- %30 = OpLoad %6 %13
- %31 = OpFAdd %6 %30 %29
- OpStore %13 %31
- OpBranch %28
- %28 = OpLabel
- %33 = OpAccessChain %21 %18 %32
- %34 = OpLoad %15 %33
- %35 = OpConvertUToF %6 %34
- %36 = OpExtInst %6 %1 Log2 %35
- %37 = OpLoad %6 %13
- %38 = OpFAdd %6 %37 %36
- OpStore %13 %38
- %39 = OpLoad %6 %13
- %40 = OpLoad %6 %13
- %41 = OpExtInst %6 %1 Sqrt %40
- %42 = OpFSub %6 %39 %41
- OpReturnValue %42
- OpFunctionEnd
- %10 = OpFunction %6 None %7
- %11 = OpLabel
- %45 = OpVariable %12 Function
- %46 = OpAccessChain %21 %18 %20
- %47 = OpLoad %15 %46
- %48 = OpConvertUToF %6 %47
- %50 = OpFDiv %6 %48 %49
- OpStore %45 %50
- %51 = OpLoad %6 %45
- %54 = OpExtInst %6 %1 FClamp %51 %52 %53
- %55 = OpLoad %6 %45
- %56 = OpFMul %6 %55 %54
- OpStore %45 %56
- %57 = OpLoad %6 %45
- %58 = OpExtInst %6 %1 Exp %57
- OpReturnValue %58
- OpFunctionEnd
- )";
- constexpr char kDst[] = R"( OpCapability Shader
- %1 = OpExtInstImport "GLSL.std.450"
- OpMemoryModel Logical GLSL450
- OpEntryPoint Fragment %4 "main" %63 %69
- OpExecutionMode %4 OriginUpperLeft
- OpSource ESSL 310
- OpName %4 "main"
- OpName %8 "f1("
- OpName %10 "f2("
- OpName %13 "v"
- OpName %16 "Buffer"
- OpMemberName %16 0 "flag1"
- OpMemberName %16 1 "flag2"
- OpName %18 ""
- OpName %34 "v"
- OpName %63 "color"
- OpName %69 "v"
- OpDecorate %8 RelaxedPrecision
- OpDecorate %10 RelaxedPrecision
- OpDecorate %13 RelaxedPrecision
- OpMemberDecorate %16 0 RelaxedPrecision
- OpMemberDecorate %16 0 Offset 0
- OpMemberDecorate %16 1 RelaxedPrecision
- OpMemberDecorate %16 1 Offset 4
- OpDecorate %16 Block
- OpDecorate %18 DescriptorSet 0
- OpDecorate %18 Binding 0
- OpDecorate %23 RelaxedPrecision
- OpDecorate %24 RelaxedPrecision
- OpDecorate %25 RelaxedPrecision
- OpDecorate %26 RelaxedPrecision
- OpDecorate %27 RelaxedPrecision
- OpDecorate %28 RelaxedPrecision
- OpDecorate %29 RelaxedPrecision
- OpDecorate %30 RelaxedPrecision
- OpDecorate %31 RelaxedPrecision
- OpDecorate %34 RelaxedPrecision
- OpDecorate %37 RelaxedPrecision
- OpDecorate %38 RelaxedPrecision
- OpDecorate %40 RelaxedPrecision
- OpDecorate %41 RelaxedPrecision
- OpDecorate %44 RelaxedPrecision
- OpDecorate %45 RelaxedPrecision
- OpDecorate %46 RelaxedPrecision
- OpDecorate %48 RelaxedPrecision
- OpDecorate %55 RelaxedPrecision
- OpDecorate %56 RelaxedPrecision
- OpDecorate %57 RelaxedPrecision
- OpDecorate %58 RelaxedPrecision
- OpDecorate %63 RelaxedPrecision
- OpDecorate %63 Location 0
- OpDecorate %64 RelaxedPrecision
- OpDecorate %65 RelaxedPrecision
- OpDecorate %67 RelaxedPrecision
- OpDecorate %69 RelaxedPrecision
- OpDecorate %69 Location 0
- %2 = OpTypeVoid
- %3 = OpTypeFunction %2
- %6 = OpTypeFloat 32
- %7 = OpTypeFunction %6
- %12 = OpTypePointer Function %6
- %14 = OpConstant %6 0
- %15 = OpTypeInt 32 0
- %16 = OpTypeStruct %15 %15
- %17 = OpTypePointer Uniform %16
- %18 = OpVariable %17 Uniform
- %19 = OpTypeInt 32 1
- %20 = OpConstant %19 1
- %21 = OpTypePointer Uniform %15
- %35 = OpConstant %19 0
- %39 = OpConstant %6 10
- %42 = OpConstant %6 0.5
- %43 = OpConstant %6 0.699999988
- %49 = OpConstant %15 0
- %50 = OpTypeBool
- %54 = OpConstant %6 0.100000001
- %61 = OpTypeVector %6 4
- %62 = OpTypePointer Output %61
- %63 = OpVariable %62 Output
- %66 = OpConstant %6 1
- %68 = OpTypePointer Input %6
- %69 = OpVariable %68 Input
- %4 = OpFunction %2 None %3
- %5 = OpLabel
- %64 = OpFunctionCall %6 %8
- %65 = OpFunctionCall %6 %10
- %67 = OpCompositeConstruct %61 %64 %65 %14 %66
- OpStore %63 %67
- OpReturn
- OpFunctionEnd
- %8 = OpFunction %6 None %7
- %9 = OpLabel
- %13 = OpVariable %12 Function
- OpStore %13 %14
- %22 = OpAccessChain %21 %18 %20
- %23 = OpLoad %15 %22
- %24 = OpConvertUToF %6 %23
- %25 = OpExtInst %6 %1 Log2 %24
- %26 = OpLoad %6 %13
- %27 = OpFAdd %6 %26 %25
- OpStore %13 %27
- %28 = OpLoad %6 %13
- %29 = OpLoad %6 %13
- %30 = OpExtInst %6 %1 Sqrt %29
- %31 = OpFSub %6 %28 %30
- OpReturnValue %31
- OpFunctionEnd
- %10 = OpFunction %6 None %7
- %11 = OpLabel
- %34 = OpVariable %12 Function
- %36 = OpAccessChain %21 %18 %35
- %37 = OpLoad %15 %36
- %38 = OpConvertUToF %6 %37
- %40 = OpFDiv %6 %38 %39
- OpStore %34 %40
- %41 = OpLoad %6 %34
- %44 = OpExtInst %6 %1 FClamp %41 %42 %43
- %45 = OpLoad %6 %34
- %46 = OpFMul %6 %45 %44
- OpStore %34 %46
- %47 = OpAccessChain %21 %18 %20
- %48 = OpLoad %15 %47
- %51 = OpINotEqual %50 %48 %49
- OpSelectionMerge %53 None
- OpBranchConditional %51 %52 %53
- %52 = OpLabel
- %55 = OpLoad %6 %34
- %56 = OpFSub %6 %55 %54
- OpStore %34 %56
- OpBranch %53
- %53 = OpLabel
- %57 = OpLoad %6 %34
- %58 = OpExtInst %6 %1 Exp %57
- OpReturnValue %58
- OpFunctionEnd
- )";
- TEST(DiffTest, ExtraIfBlock) {
- constexpr char kDiff[] = R"( ; SPIR-V
- ; Version: 1.6
- ; Generator: Khronos SPIR-V Tools Assembler; 0
- -; Bound: 69
- +; Bound: 77
- ; Schema: 0
- OpCapability Shader
- %1 = OpExtInstImport "GLSL.std.450"
- OpMemoryModel Logical GLSL450
- OpEntryPoint Fragment %4 "main" %63 %68
- OpExecutionMode %4 OriginUpperLeft
- OpSource ESSL 310
- OpName %4 "main"
- OpName %8 "f1("
- OpName %10 "f2("
- OpName %13 "v"
- OpName %16 "Buffer"
- OpMemberName %16 0 "flag1"
- OpMemberName %16 1 "flag2"
- OpName %18 ""
- OpName %45 "v"
- OpName %63 "color"
- OpName %68 "v"
- OpDecorate %8 RelaxedPrecision
- OpDecorate %10 RelaxedPrecision
- OpDecorate %13 RelaxedPrecision
- OpMemberDecorate %16 0 RelaxedPrecision
- OpMemberDecorate %16 0 Offset 0
- OpMemberDecorate %16 1 RelaxedPrecision
- OpMemberDecorate %16 1 Offset 4
- OpDecorate %16 Block
- OpDecorate %18 DescriptorSet 0
- OpDecorate %18 Binding 0
- -OpDecorate %23 RelaxedPrecision
- -OpDecorate %30 RelaxedPrecision
- -OpDecorate %31 RelaxedPrecision
- OpDecorate %34 RelaxedPrecision
- OpDecorate %35 RelaxedPrecision
- OpDecorate %36 RelaxedPrecision
- OpDecorate %37 RelaxedPrecision
- OpDecorate %38 RelaxedPrecision
- OpDecorate %39 RelaxedPrecision
- OpDecorate %40 RelaxedPrecision
- OpDecorate %41 RelaxedPrecision
- OpDecorate %42 RelaxedPrecision
- OpDecorate %45 RelaxedPrecision
- OpDecorate %47 RelaxedPrecision
- OpDecorate %48 RelaxedPrecision
- OpDecorate %50 RelaxedPrecision
- OpDecorate %51 RelaxedPrecision
- OpDecorate %54 RelaxedPrecision
- OpDecorate %55 RelaxedPrecision
- OpDecorate %56 RelaxedPrecision
- +OpDecorate %70 RelaxedPrecision
- OpDecorate %57 RelaxedPrecision
- +OpDecorate %75 RelaxedPrecision
- +OpDecorate %76 RelaxedPrecision
- OpDecorate %58 RelaxedPrecision
- OpDecorate %63 RelaxedPrecision
- OpDecorate %63 Location 0
- OpDecorate %64 RelaxedPrecision
- OpDecorate %65 RelaxedPrecision
- OpDecorate %66 RelaxedPrecision
- OpDecorate %68 RelaxedPrecision
- OpDecorate %68 Location 0
- %2 = OpTypeVoid
- %3 = OpTypeFunction %2
- %6 = OpTypeFloat 32
- %7 = OpTypeFunction %6
- %12 = OpTypePointer Function %6
- %14 = OpConstant %6 0
- %15 = OpTypeInt 32 0
- %16 = OpTypeStruct %15 %15
- %17 = OpTypePointer Uniform %16
- %18 = OpVariable %17 Uniform
- %19 = OpTypeInt 32 1
- %20 = OpConstant %19 0
- %21 = OpTypePointer Uniform %15
- %24 = OpConstant %15 0
- %25 = OpTypeBool
- %29 = OpConstant %6 1
- %32 = OpConstant %19 1
- %49 = OpConstant %6 10
- %52 = OpConstant %6 0.5
- +%74 = OpConstant %6 0.100000001
- %53 = OpConstant %6 0.699999988
- %61 = OpTypeVector %6 4
- %62 = OpTypePointer Output %61
- %63 = OpVariable %62 Output
- %67 = OpTypePointer Input %6
- %68 = OpVariable %67 Input
- %4 = OpFunction %2 None %3
- %5 = OpLabel
- %64 = OpFunctionCall %6 %8
- %65 = OpFunctionCall %6 %10
- %66 = OpCompositeConstruct %61 %64 %65 %14 %29
- OpStore %63 %66
- OpReturn
- OpFunctionEnd
- %8 = OpFunction %6 None %7
- %9 = OpLabel
- %13 = OpVariable %12 Function
- OpStore %13 %14
- -%22 = OpAccessChain %21 %18 %20
- -%23 = OpLoad %15 %22
- -%26 = OpINotEqual %25 %23 %24
- -OpSelectionMerge %28 None
- -OpBranchConditional %26 %27 %28
- -%27 = OpLabel
- -%30 = OpLoad %6 %13
- -%31 = OpFAdd %6 %30 %29
- -OpStore %13 %31
- -OpBranch %28
- -%28 = OpLabel
- %33 = OpAccessChain %21 %18 %32
- %34 = OpLoad %15 %33
- %35 = OpConvertUToF %6 %34
- %36 = OpExtInst %6 %1 Log2 %35
- %37 = OpLoad %6 %13
- %38 = OpFAdd %6 %37 %36
- OpStore %13 %38
- %39 = OpLoad %6 %13
- %40 = OpLoad %6 %13
- %41 = OpExtInst %6 %1 Sqrt %40
- %42 = OpFSub %6 %39 %41
- OpReturnValue %42
- OpFunctionEnd
- %10 = OpFunction %6 None %7
- %11 = OpLabel
- %45 = OpVariable %12 Function
- %46 = OpAccessChain %21 %18 %20
- %47 = OpLoad %15 %46
- %48 = OpConvertUToF %6 %47
- %50 = OpFDiv %6 %48 %49
- OpStore %45 %50
- %51 = OpLoad %6 %45
- %54 = OpExtInst %6 %1 FClamp %51 %52 %53
- %55 = OpLoad %6 %45
- %56 = OpFMul %6 %55 %54
- OpStore %45 %56
- +%69 = OpAccessChain %21 %18 %32
- +%70 = OpLoad %15 %69
- +%71 = OpINotEqual %25 %70 %24
- +OpSelectionMerge %73 None
- +OpBranchConditional %71 %72 %73
- +%72 = OpLabel
- %57 = OpLoad %6 %45
- +%75 = OpFSub %6 %57 %74
- +OpStore %45 %75
- +OpBranch %73
- +%73 = OpLabel
- +%76 = OpLoad %6 %45
- -%58 = OpExtInst %6 %1 Exp %57
- +%58 = OpExtInst %6 %1 Exp %76
- OpReturnValue %58
- OpFunctionEnd
- )";
- Options options;
- DoStringDiffTest(kSrc, kDst, kDiff, options);
- }
- TEST(DiffTest, ExtraIfBlockNoDebug) {
- constexpr char kSrcNoDebug[] = R"( OpCapability Shader
- %1 = OpExtInstImport "GLSL.std.450"
- OpMemoryModel Logical GLSL450
- OpEntryPoint Fragment %4 "main" %63 %68
- OpExecutionMode %4 OriginUpperLeft
- OpSource ESSL 310
- OpDecorate %8 RelaxedPrecision
- OpDecorate %10 RelaxedPrecision
- OpDecorate %13 RelaxedPrecision
- OpMemberDecorate %16 0 RelaxedPrecision
- OpMemberDecorate %16 0 Offset 0
- OpMemberDecorate %16 1 RelaxedPrecision
- OpMemberDecorate %16 1 Offset 4
- OpDecorate %16 Block
- OpDecorate %18 DescriptorSet 0
- OpDecorate %18 Binding 0
- OpDecorate %23 RelaxedPrecision
- OpDecorate %30 RelaxedPrecision
- OpDecorate %31 RelaxedPrecision
- OpDecorate %34 RelaxedPrecision
- OpDecorate %35 RelaxedPrecision
- OpDecorate %36 RelaxedPrecision
- OpDecorate %37 RelaxedPrecision
- OpDecorate %38 RelaxedPrecision
- OpDecorate %39 RelaxedPrecision
- OpDecorate %40 RelaxedPrecision
- OpDecorate %41 RelaxedPrecision
- OpDecorate %42 RelaxedPrecision
- OpDecorate %45 RelaxedPrecision
- OpDecorate %47 RelaxedPrecision
- OpDecorate %48 RelaxedPrecision
- OpDecorate %50 RelaxedPrecision
- OpDecorate %51 RelaxedPrecision
- OpDecorate %54 RelaxedPrecision
- OpDecorate %55 RelaxedPrecision
- OpDecorate %56 RelaxedPrecision
- OpDecorate %57 RelaxedPrecision
- OpDecorate %58 RelaxedPrecision
- OpDecorate %63 RelaxedPrecision
- OpDecorate %63 Location 0
- OpDecorate %64 RelaxedPrecision
- OpDecorate %65 RelaxedPrecision
- OpDecorate %66 RelaxedPrecision
- OpDecorate %68 RelaxedPrecision
- OpDecorate %68 Location 0
- %2 = OpTypeVoid
- %3 = OpTypeFunction %2
- %6 = OpTypeFloat 32
- %7 = OpTypeFunction %6
- %12 = OpTypePointer Function %6
- %14 = OpConstant %6 0
- %15 = OpTypeInt 32 0
- %16 = OpTypeStruct %15 %15
- %17 = OpTypePointer Uniform %16
- %18 = OpVariable %17 Uniform
- %19 = OpTypeInt 32 1
- %20 = OpConstant %19 0
- %21 = OpTypePointer Uniform %15
- %24 = OpConstant %15 0
- %25 = OpTypeBool
- %29 = OpConstant %6 1
- %32 = OpConstant %19 1
- %49 = OpConstant %6 10
- %52 = OpConstant %6 0.5
- %53 = OpConstant %6 0.699999988
- %61 = OpTypeVector %6 4
- %62 = OpTypePointer Output %61
- %63 = OpVariable %62 Output
- %67 = OpTypePointer Input %6
- %68 = OpVariable %67 Input
- %4 = OpFunction %2 None %3
- %5 = OpLabel
- %64 = OpFunctionCall %6 %8
- %65 = OpFunctionCall %6 %10
- %66 = OpCompositeConstruct %61 %64 %65 %14 %29
- OpStore %63 %66
- OpReturn
- OpFunctionEnd
- %8 = OpFunction %6 None %7
- %9 = OpLabel
- %13 = OpVariable %12 Function
- OpStore %13 %14
- %22 = OpAccessChain %21 %18 %20
- %23 = OpLoad %15 %22
- %26 = OpINotEqual %25 %23 %24
- OpSelectionMerge %28 None
- OpBranchConditional %26 %27 %28
- %27 = OpLabel
- %30 = OpLoad %6 %13
- %31 = OpFAdd %6 %30 %29
- OpStore %13 %31
- OpBranch %28
- %28 = OpLabel
- %33 = OpAccessChain %21 %18 %32
- %34 = OpLoad %15 %33
- %35 = OpConvertUToF %6 %34
- %36 = OpExtInst %6 %1 Log2 %35
- %37 = OpLoad %6 %13
- %38 = OpFAdd %6 %37 %36
- OpStore %13 %38
- %39 = OpLoad %6 %13
- %40 = OpLoad %6 %13
- %41 = OpExtInst %6 %1 Sqrt %40
- %42 = OpFSub %6 %39 %41
- OpReturnValue %42
- OpFunctionEnd
- %10 = OpFunction %6 None %7
- %11 = OpLabel
- %45 = OpVariable %12 Function
- %46 = OpAccessChain %21 %18 %20
- %47 = OpLoad %15 %46
- %48 = OpConvertUToF %6 %47
- %50 = OpFDiv %6 %48 %49
- OpStore %45 %50
- %51 = OpLoad %6 %45
- %54 = OpExtInst %6 %1 FClamp %51 %52 %53
- %55 = OpLoad %6 %45
- %56 = OpFMul %6 %55 %54
- OpStore %45 %56
- %57 = OpLoad %6 %45
- %58 = OpExtInst %6 %1 Exp %57
- OpReturnValue %58
- OpFunctionEnd
- )";
- constexpr char kDstNoDebug[] = R"( OpCapability Shader
- %1 = OpExtInstImport "GLSL.std.450"
- OpMemoryModel Logical GLSL450
- OpEntryPoint Fragment %4 "main" %63 %69
- OpExecutionMode %4 OriginUpperLeft
- OpSource ESSL 310
- OpDecorate %8 RelaxedPrecision
- OpDecorate %10 RelaxedPrecision
- OpDecorate %13 RelaxedPrecision
- OpMemberDecorate %16 0 RelaxedPrecision
- OpMemberDecorate %16 0 Offset 0
- OpMemberDecorate %16 1 RelaxedPrecision
- OpMemberDecorate %16 1 Offset 4
- OpDecorate %16 Block
- OpDecorate %18 DescriptorSet 0
- OpDecorate %18 Binding 0
- OpDecorate %23 RelaxedPrecision
- OpDecorate %24 RelaxedPrecision
- OpDecorate %25 RelaxedPrecision
- OpDecorate %26 RelaxedPrecision
- OpDecorate %27 RelaxedPrecision
- OpDecorate %28 RelaxedPrecision
- OpDecorate %29 RelaxedPrecision
- OpDecorate %30 RelaxedPrecision
- OpDecorate %31 RelaxedPrecision
- OpDecorate %34 RelaxedPrecision
- OpDecorate %37 RelaxedPrecision
- OpDecorate %38 RelaxedPrecision
- OpDecorate %40 RelaxedPrecision
- OpDecorate %41 RelaxedPrecision
- OpDecorate %44 RelaxedPrecision
- OpDecorate %45 RelaxedPrecision
- OpDecorate %46 RelaxedPrecision
- OpDecorate %48 RelaxedPrecision
- OpDecorate %55 RelaxedPrecision
- OpDecorate %56 RelaxedPrecision
- OpDecorate %57 RelaxedPrecision
- OpDecorate %58 RelaxedPrecision
- OpDecorate %63 RelaxedPrecision
- OpDecorate %63 Location 0
- OpDecorate %64 RelaxedPrecision
- OpDecorate %65 RelaxedPrecision
- OpDecorate %67 RelaxedPrecision
- OpDecorate %69 RelaxedPrecision
- OpDecorate %69 Location 0
- %2 = OpTypeVoid
- %3 = OpTypeFunction %2
- %6 = OpTypeFloat 32
- %7 = OpTypeFunction %6
- %12 = OpTypePointer Function %6
- %14 = OpConstant %6 0
- %15 = OpTypeInt 32 0
- %16 = OpTypeStruct %15 %15
- %17 = OpTypePointer Uniform %16
- %18 = OpVariable %17 Uniform
- %19 = OpTypeInt 32 1
- %20 = OpConstant %19 1
- %21 = OpTypePointer Uniform %15
- %35 = OpConstant %19 0
- %39 = OpConstant %6 10
- %42 = OpConstant %6 0.5
- %43 = OpConstant %6 0.699999988
- %49 = OpConstant %15 0
- %50 = OpTypeBool
- %54 = OpConstant %6 0.100000001
- %61 = OpTypeVector %6 4
- %62 = OpTypePointer Output %61
- %63 = OpVariable %62 Output
- %66 = OpConstant %6 1
- %68 = OpTypePointer Input %6
- %69 = OpVariable %68 Input
- %4 = OpFunction %2 None %3
- %5 = OpLabel
- %64 = OpFunctionCall %6 %8
- %65 = OpFunctionCall %6 %10
- %67 = OpCompositeConstruct %61 %64 %65 %14 %66
- OpStore %63 %67
- OpReturn
- OpFunctionEnd
- %8 = OpFunction %6 None %7
- %9 = OpLabel
- %13 = OpVariable %12 Function
- OpStore %13 %14
- %22 = OpAccessChain %21 %18 %20
- %23 = OpLoad %15 %22
- %24 = OpConvertUToF %6 %23
- %25 = OpExtInst %6 %1 Log2 %24
- %26 = OpLoad %6 %13
- %27 = OpFAdd %6 %26 %25
- OpStore %13 %27
- %28 = OpLoad %6 %13
- %29 = OpLoad %6 %13
- %30 = OpExtInst %6 %1 Sqrt %29
- %31 = OpFSub %6 %28 %30
- OpReturnValue %31
- OpFunctionEnd
- %10 = OpFunction %6 None %7
- %11 = OpLabel
- %34 = OpVariable %12 Function
- %36 = OpAccessChain %21 %18 %35
- %37 = OpLoad %15 %36
- %38 = OpConvertUToF %6 %37
- %40 = OpFDiv %6 %38 %39
- OpStore %34 %40
- %41 = OpLoad %6 %34
- %44 = OpExtInst %6 %1 FClamp %41 %42 %43
- %45 = OpLoad %6 %34
- %46 = OpFMul %6 %45 %44
- OpStore %34 %46
- %47 = OpAccessChain %21 %18 %20
- %48 = OpLoad %15 %47
- %51 = OpINotEqual %50 %48 %49
- OpSelectionMerge %53 None
- OpBranchConditional %51 %52 %53
- %52 = OpLabel
- %55 = OpLoad %6 %34
- %56 = OpFSub %6 %55 %54
- OpStore %34 %56
- OpBranch %53
- %53 = OpLabel
- %57 = OpLoad %6 %34
- %58 = OpExtInst %6 %1 Exp %57
- OpReturnValue %58
- OpFunctionEnd
- )";
- constexpr char kDiff[] = R"( ; SPIR-V
- ; Version: 1.6
- ; Generator: Khronos SPIR-V Tools Assembler; 0
- -; Bound: 69
- +; Bound: 77
- ; Schema: 0
- OpCapability Shader
- %1 = OpExtInstImport "GLSL.std.450"
- OpMemoryModel Logical GLSL450
- OpEntryPoint Fragment %4 "main" %63 %68
- OpExecutionMode %4 OriginUpperLeft
- OpSource ESSL 310
- OpDecorate %8 RelaxedPrecision
- OpDecorate %10 RelaxedPrecision
- OpDecorate %13 RelaxedPrecision
- OpMemberDecorate %16 0 RelaxedPrecision
- OpMemberDecorate %16 0 Offset 0
- OpMemberDecorate %16 1 RelaxedPrecision
- OpMemberDecorate %16 1 Offset 4
- OpDecorate %16 Block
- OpDecorate %18 DescriptorSet 0
- OpDecorate %18 Binding 0
- -OpDecorate %23 RelaxedPrecision
- -OpDecorate %30 RelaxedPrecision
- -OpDecorate %31 RelaxedPrecision
- OpDecorate %34 RelaxedPrecision
- OpDecorate %35 RelaxedPrecision
- OpDecorate %36 RelaxedPrecision
- OpDecorate %37 RelaxedPrecision
- OpDecorate %38 RelaxedPrecision
- OpDecorate %39 RelaxedPrecision
- OpDecorate %40 RelaxedPrecision
- OpDecorate %41 RelaxedPrecision
- OpDecorate %42 RelaxedPrecision
- OpDecorate %45 RelaxedPrecision
- OpDecorate %47 RelaxedPrecision
- OpDecorate %48 RelaxedPrecision
- OpDecorate %50 RelaxedPrecision
- OpDecorate %51 RelaxedPrecision
- OpDecorate %54 RelaxedPrecision
- OpDecorate %55 RelaxedPrecision
- OpDecorate %56 RelaxedPrecision
- +OpDecorate %70 RelaxedPrecision
- OpDecorate %57 RelaxedPrecision
- +OpDecorate %75 RelaxedPrecision
- +OpDecorate %76 RelaxedPrecision
- OpDecorate %58 RelaxedPrecision
- OpDecorate %63 RelaxedPrecision
- OpDecorate %63 Location 0
- OpDecorate %64 RelaxedPrecision
- OpDecorate %65 RelaxedPrecision
- OpDecorate %66 RelaxedPrecision
- OpDecorate %68 RelaxedPrecision
- OpDecorate %68 Location 0
- %2 = OpTypeVoid
- %3 = OpTypeFunction %2
- %6 = OpTypeFloat 32
- %7 = OpTypeFunction %6
- %12 = OpTypePointer Function %6
- %14 = OpConstant %6 0
- %15 = OpTypeInt 32 0
- %16 = OpTypeStruct %15 %15
- %17 = OpTypePointer Uniform %16
- %18 = OpVariable %17 Uniform
- %19 = OpTypeInt 32 1
- %20 = OpConstant %19 0
- %21 = OpTypePointer Uniform %15
- %24 = OpConstant %15 0
- %25 = OpTypeBool
- %29 = OpConstant %6 1
- %32 = OpConstant %19 1
- %49 = OpConstant %6 10
- %52 = OpConstant %6 0.5
- +%74 = OpConstant %6 0.100000001
- %53 = OpConstant %6 0.699999988
- %61 = OpTypeVector %6 4
- %62 = OpTypePointer Output %61
- %63 = OpVariable %62 Output
- %67 = OpTypePointer Input %6
- %68 = OpVariable %67 Input
- %4 = OpFunction %2 None %3
- %5 = OpLabel
- %64 = OpFunctionCall %6 %8
- %65 = OpFunctionCall %6 %10
- %66 = OpCompositeConstruct %61 %64 %65 %14 %29
- OpStore %63 %66
- OpReturn
- OpFunctionEnd
- %8 = OpFunction %6 None %7
- %9 = OpLabel
- %13 = OpVariable %12 Function
- OpStore %13 %14
- -%22 = OpAccessChain %21 %18 %20
- -%23 = OpLoad %15 %22
- -%26 = OpINotEqual %25 %23 %24
- -OpSelectionMerge %28 None
- -OpBranchConditional %26 %27 %28
- -%27 = OpLabel
- -%30 = OpLoad %6 %13
- -%31 = OpFAdd %6 %30 %29
- -OpStore %13 %31
- -OpBranch %28
- -%28 = OpLabel
- %33 = OpAccessChain %21 %18 %32
- %34 = OpLoad %15 %33
- %35 = OpConvertUToF %6 %34
- %36 = OpExtInst %6 %1 Log2 %35
- %37 = OpLoad %6 %13
- %38 = OpFAdd %6 %37 %36
- OpStore %13 %38
- %39 = OpLoad %6 %13
- %40 = OpLoad %6 %13
- %41 = OpExtInst %6 %1 Sqrt %40
- %42 = OpFSub %6 %39 %41
- OpReturnValue %42
- OpFunctionEnd
- %10 = OpFunction %6 None %7
- %11 = OpLabel
- %45 = OpVariable %12 Function
- %46 = OpAccessChain %21 %18 %20
- %47 = OpLoad %15 %46
- %48 = OpConvertUToF %6 %47
- %50 = OpFDiv %6 %48 %49
- OpStore %45 %50
- %51 = OpLoad %6 %45
- %54 = OpExtInst %6 %1 FClamp %51 %52 %53
- %55 = OpLoad %6 %45
- %56 = OpFMul %6 %55 %54
- OpStore %45 %56
- +%69 = OpAccessChain %21 %18 %32
- +%70 = OpLoad %15 %69
- +%71 = OpINotEqual %25 %70 %24
- +OpSelectionMerge %73 None
- +OpBranchConditional %71 %72 %73
- +%72 = OpLabel
- %57 = OpLoad %6 %45
- +%75 = OpFSub %6 %57 %74
- +OpStore %45 %75
- +OpBranch %73
- +%73 = OpLabel
- +%76 = OpLoad %6 %45
- -%58 = OpExtInst %6 %1 Exp %57
- +%58 = OpExtInst %6 %1 Exp %76
- OpReturnValue %58
- OpFunctionEnd
- )";
- Options options;
- DoStringDiffTest(kSrcNoDebug, kDstNoDebug, kDiff, options);
- }
- } // namespace
- } // namespace diff
- } // namespace spvtools
|