diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-04-28 03:05:41 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-04-28 03:05:41 +0000 |
commit | d1cf0210b24d17a9234c2fdca8c26d07884c3531 (patch) | |
tree | a0885b0caacd225d14600909f71969741fc4f3e2 /test/diff/diff_files/multiple_same_entry_points_autogen.cpp | |
parent | 3fb7f0dbd5fb2598f62820dcb5e7b035d982a4be (diff) | |
parent | 31e364bbe017350c2ec473665ac25db095654add (diff) | |
download | spirv-tools-3e97b455b0d9ae3d8c9749298a75def0cef66c43.tar.gz |
Snap for 8508678 from 31e364bbe017350c2ec473665ac25db095654add to ndk-r25-releasendk-r25cndk-r25bndk-r25ndk-r25-release
Change-Id: Ibe0eaaf901883a93e51af2b8de136c0742614413
Diffstat (limited to 'test/diff/diff_files/multiple_same_entry_points_autogen.cpp')
-rw-r--r-- | test/diff/diff_files/multiple_same_entry_points_autogen.cpp | 375 |
1 files changed, 375 insertions, 0 deletions
diff --git a/test/diff/diff_files/multiple_same_entry_points_autogen.cpp b/test/diff/diff_files/multiple_same_entry_points_autogen.cpp new file mode 100644 index 00000000..9d011661 --- /dev/null +++ b/test/diff/diff_files/multiple_same_entry_points_autogen.cpp @@ -0,0 +1,375 @@ +// 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 for multiple entry points with the same execution model. +constexpr char kSrc[] = R"( OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %4 "main1" %8 %10 + OpEntryPoint Vertex %12 "main2" %13 %14 %15 + OpSource ESSL 310 + OpName %4 "main1" + OpName %12 "main2" + OpName %8 "v" + OpName %10 "a" + OpName %13 "v" + OpName %14 "a" + OpName %15 "b" + OpDecorate %8 Location 0 + OpDecorate %10 Location 0 + OpDecorate %13 Location 0 + OpDecorate %14 Location 0 + OpDecorate %15 Location 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + + %7 = OpTypePointer Output %6 + %9 = OpTypePointer Input %6 + %8 = OpVariable %7 Output + %10 = OpVariable %9 Input + %13 = OpVariable %7 Output + %14 = OpVariable %9 Input + %15 = OpVariable %9 Input + + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpLoad %6 %10 + OpStore %8 %11 + OpReturn + OpFunctionEnd + + %12 = OpFunction %2 None %3 + %16 = OpLabel + %17 = OpLoad %6 %14 + %18 = OpLoad %6 %15 + %19 = OpFAdd %6 %17 %18 + OpStore %13 %19 + OpReturn + OpFunctionEnd)"; +constexpr char kDst[] = R"( OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %4 "main2" %13 %14 %15 + OpEntryPoint Vertex %12 "main1" %8 %10 + OpSource ESSL 310 + OpName %12 "main1" + OpName %4 "main2" + OpName %8 "v" + OpName %10 "a" + OpName %13 "v" + OpName %14 "a" + OpName %15 "b" + OpDecorate %8 Location 0 + OpDecorate %10 Location 0 + OpDecorate %13 Location 0 + OpDecorate %14 Location 0 + OpDecorate %15 Location 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + + %7 = OpTypePointer Output %6 + %9 = OpTypePointer Input %6 + %8 = OpVariable %7 Output + %10 = OpVariable %9 Input + %13 = OpVariable %7 Output + %14 = OpVariable %9 Input + %15 = OpVariable %9 Input + + %4 = OpFunction %2 None %3 + %16 = OpLabel + %17 = OpLoad %6 %14 + %18 = OpLoad %6 %15 + %19 = OpFAdd %6 %17 %18 + OpStore %13 %19 + OpReturn + OpFunctionEnd + + %12 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpLoad %6 %10 + OpStore %8 %11 + OpReturn + OpFunctionEnd +)"; + +TEST(DiffTest, MultipleSameEntryPoints) { + constexpr char kDiff[] = R"( ; SPIR-V + ; Version: 1.6 + ; Generator: Khronos SPIR-V Tools Assembler; 0 + ; Bound: 20 + ; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 ++OpEntryPoint Vertex %12 "main2" %13 %14 %15 + OpEntryPoint Vertex %4 "main1" %8 %10 +-OpEntryPoint Vertex %12 "main2" %13 %14 %15 + OpSource ESSL 310 + OpName %4 "main1" + OpName %12 "main2" + OpName %8 "v" + OpName %10 "a" + OpName %13 "v" + OpName %14 "a" + OpName %15 "b" + OpDecorate %8 Location 0 + OpDecorate %10 Location 0 + OpDecorate %13 Location 0 + OpDecorate %14 Location 0 + OpDecorate %15 Location 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Output %6 + %9 = OpTypePointer Input %6 + %8 = OpVariable %7 Output + %10 = OpVariable %9 Input + %13 = OpVariable %7 Output + %14 = OpVariable %9 Input + %15 = OpVariable %9 Input + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpLoad %6 %10 + OpStore %8 %11 + OpReturn + OpFunctionEnd + %12 = OpFunction %2 None %3 + %16 = OpLabel + %17 = OpLoad %6 %14 + %18 = OpLoad %6 %15 + %19 = OpFAdd %6 %17 %18 + OpStore %13 %19 + OpReturn + OpFunctionEnd +)"; + Options options; + DoStringDiffTest(kSrc, kDst, kDiff, options); +} + +TEST(DiffTest, MultipleSameEntryPointsNoDebug) { + constexpr char kSrcNoDebug[] = R"( OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %4 "main1" %8 %10 + OpEntryPoint Vertex %12 "main2" %13 %14 %15 + OpSource ESSL 310 + OpDecorate %8 Location 0 + OpDecorate %10 Location 0 + OpDecorate %13 Location 0 + OpDecorate %14 Location 0 + OpDecorate %15 Location 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + + %7 = OpTypePointer Output %6 + %9 = OpTypePointer Input %6 + %8 = OpVariable %7 Output + %10 = OpVariable %9 Input + %13 = OpVariable %7 Output + %14 = OpVariable %9 Input + %15 = OpVariable %9 Input + + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpLoad %6 %10 + OpStore %8 %11 + OpReturn + OpFunctionEnd + + %12 = OpFunction %2 None %3 + %16 = OpLabel + %17 = OpLoad %6 %14 + %18 = OpLoad %6 %15 + %19 = OpFAdd %6 %17 %18 + OpStore %13 %19 + OpReturn + OpFunctionEnd +)"; + constexpr char kDstNoDebug[] = R"( OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %4 "main2" %13 %14 %15 + OpEntryPoint Vertex %12 "main1" %8 %10 + OpSource ESSL 310 + OpDecorate %8 Location 0 + OpDecorate %10 Location 0 + OpDecorate %13 Location 0 + OpDecorate %14 Location 0 + OpDecorate %15 Location 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + + %7 = OpTypePointer Output %6 + %9 = OpTypePointer Input %6 + %8 = OpVariable %7 Output + %10 = OpVariable %9 Input + %13 = OpVariable %7 Output + %14 = OpVariable %9 Input + %15 = OpVariable %9 Input + + %4 = OpFunction %2 None %3 + %16 = OpLabel + %17 = OpLoad %6 %14 + %18 = OpLoad %6 %15 + %19 = OpFAdd %6 %17 %18 + OpStore %13 %19 + OpReturn + OpFunctionEnd + + %12 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpLoad %6 %10 + OpStore %8 %11 + OpReturn + OpFunctionEnd +)"; + constexpr char kDiff[] = R"( ; SPIR-V + ; Version: 1.6 + ; Generator: Khronos SPIR-V Tools Assembler; 0 + ; Bound: 20 + ; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 ++OpEntryPoint Vertex %12 "main2" %13 %14 %15 + OpEntryPoint Vertex %4 "main1" %8 %10 +-OpEntryPoint Vertex %12 "main2" %13 %14 %15 + OpSource ESSL 310 + OpDecorate %8 Location 0 + OpDecorate %10 Location 0 + OpDecorate %13 Location 0 + OpDecorate %14 Location 0 + OpDecorate %15 Location 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Output %6 + %9 = OpTypePointer Input %6 + %8 = OpVariable %7 Output + %10 = OpVariable %9 Input + %13 = OpVariable %7 Output + %14 = OpVariable %9 Input + %15 = OpVariable %9 Input + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpLoad %6 %10 + OpStore %8 %11 + OpReturn + OpFunctionEnd + %12 = OpFunction %2 None %3 + %16 = OpLabel + %17 = OpLoad %6 %14 + %18 = OpLoad %6 %15 + %19 = OpFAdd %6 %17 %18 + OpStore %13 %19 + OpReturn + OpFunctionEnd +)"; + Options options; + DoStringDiffTest(kSrcNoDebug, kDstNoDebug, kDiff, options); +} + +TEST(DiffTest, MultipleSameEntryPointsDumpIds) { + constexpr char kDiff[] = R"( ; SPIR-V + ; Version: 1.6 + ; Generator: Khronos SPIR-V Tools Assembler; 0 + ; Bound: 20 + ; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 ++OpEntryPoint Vertex %12 "main2" %13 %14 %15 + OpEntryPoint Vertex %4 "main1" %8 %10 +-OpEntryPoint Vertex %12 "main2" %13 %14 %15 + OpSource ESSL 310 + OpName %4 "main1" + OpName %12 "main2" + OpName %8 "v" + OpName %10 "a" + OpName %13 "v" + OpName %14 "a" + OpName %15 "b" + OpDecorate %8 Location 0 + OpDecorate %10 Location 0 + OpDecorate %13 Location 0 + OpDecorate %14 Location 0 + OpDecorate %15 Location 1 + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeFloat 32 + %7 = OpTypePointer Output %6 + %9 = OpTypePointer Input %6 + %8 = OpVariable %7 Output + %10 = OpVariable %9 Input + %13 = OpVariable %7 Output + %14 = OpVariable %9 Input + %15 = OpVariable %9 Input + %4 = OpFunction %2 None %3 + %5 = OpLabel + %11 = OpLoad %6 %10 + OpStore %8 %11 + OpReturn + OpFunctionEnd + %12 = OpFunction %2 None %3 + %16 = OpLabel + %17 = OpLoad %6 %14 + %18 = OpLoad %6 %15 + %19 = OpFAdd %6 %17 %18 + OpStore %13 %19 + OpReturn + OpFunctionEnd + Src -> Dst + 1 -> 1 [ExtInstImport] + 2 -> 2 [TypeVoid] + 3 -> 3 [TypeFunction] + 4 -> 12 [Function] + 5 -> 5 [Label] + 6 -> 6 [TypeFloat] + 7 -> 7 [TypePointer] + 8 -> 8 [Variable] + 9 -> 9 [TypePointer] + 10 -> 10 [Variable] + 11 -> 11 [Load] + 12 -> 4 [Function] + 13 -> 13 [Variable] + 14 -> 14 [Variable] + 15 -> 15 [Variable] + 16 -> 16 [Label] + 17 -> 17 [Load] + 18 -> 18 [Load] + 19 -> 19 [FAdd] +)"; + Options options; + options.dump_id_map = true; + DoStringDiffTest(kSrc, kDst, kDiff, options); +} + +} // namespace +} // namespace diff +} // namespace spvtools |