2016-01-07 18:44:22 +00:00
|
|
|
// Copyright (c) 2015-2016 The Khronos Group Inc.
|
2015-11-09 23:55:42 +00:00
|
|
|
//
|
2016-09-01 19:33:59 +00:00
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
2015-11-09 23:55:42 +00:00
|
|
|
//
|
2016-09-01 19:33:59 +00:00
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
2015-11-09 23:55:42 +00:00
|
|
|
//
|
2016-09-01 19:33:59 +00:00
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
2015-11-09 23:55:42 +00:00
|
|
|
|
|
|
|
// Assembler tests for instructions in the "Extension Instruction" section
|
|
|
|
// of the SPIR-V spec.
|
|
|
|
|
2018-08-03 19:06:09 +00:00
|
|
|
#include <string>
|
|
|
|
#include <tuple>
|
|
|
|
#include <vector>
|
2015-11-09 23:55:42 +00:00
|
|
|
|
|
|
|
#include "gmock/gmock.h"
|
2018-08-03 19:06:09 +00:00
|
|
|
#include "source/latest_version_glsl_std_450_header.h"
|
|
|
|
#include "source/latest_version_opencl_std_header.h"
|
|
|
|
#include "test/test_fixture.h"
|
|
|
|
#include "test/unit_spirv.h"
|
2015-11-09 23:55:42 +00:00
|
|
|
|
2018-07-11 13:24:49 +00:00
|
|
|
namespace spvtools {
|
2015-11-09 23:55:42 +00:00
|
|
|
namespace {
|
|
|
|
|
2018-03-05 18:34:13 +00:00
|
|
|
using spvtest::Concatenate;
|
|
|
|
using spvtest::MakeInstruction;
|
|
|
|
using spvtest::MakeVector;
|
|
|
|
using spvtest::TextToBinaryTest;
|
2018-03-14 17:06:18 +00:00
|
|
|
using ::testing::Combine;
|
|
|
|
using ::testing::Eq;
|
|
|
|
using ::testing::Values;
|
|
|
|
using ::testing::ValuesIn;
|
2015-11-09 23:55:42 +00:00
|
|
|
|
2018-02-09 19:29:02 +00:00
|
|
|
// Returns a generator of common Vulkan environment values to be tested.
|
|
|
|
std::vector<spv_target_env> CommonVulkanEnvs() {
|
|
|
|
return {SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1, SPV_ENV_UNIVERSAL_1_2,
|
|
|
|
SPV_ENV_UNIVERSAL_1_3, SPV_ENV_VULKAN_1_0, SPV_ENV_VULKAN_1_1};
|
|
|
|
}
|
|
|
|
|
2015-11-09 23:55:42 +00:00
|
|
|
TEST_F(TextToBinaryTest, InvalidExtInstImportName) {
|
|
|
|
EXPECT_THAT(CompileFailure("%1 = OpExtInstImport \"Haskell.std\""),
|
|
|
|
Eq("Invalid extended instruction import 'Haskell.std'"));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(TextToBinaryTest, InvalidImportId) {
|
|
|
|
EXPECT_THAT(CompileFailure("%1 = OpTypeVoid\n"
|
|
|
|
"%2 = OpExtInst %1 %1"),
|
|
|
|
Eq("Invalid extended instruction import Id 2"));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(TextToBinaryTest, InvalidImportInstruction) {
|
|
|
|
const std::string input = R"(%1 = OpTypeVoid
|
|
|
|
%2 = OpExtInstImport "OpenCL.std"
|
|
|
|
%3 = OpExtInst %1 %2 not_in_the_opencl)";
|
|
|
|
EXPECT_THAT(CompileFailure(input),
|
|
|
|
Eq("Invalid extended instruction name 'not_in_the_opencl'."));
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(TextToBinaryTest, MultiImport) {
|
|
|
|
const std::string input = R"(%2 = OpExtInstImport "OpenCL.std"
|
|
|
|
%2 = OpExtInstImport "OpenCL.std")";
|
|
|
|
EXPECT_THAT(CompileFailure(input),
|
|
|
|
Eq("Import Id is being defined a second time"));
|
|
|
|
}
|
|
|
|
|
2016-06-14 20:41:27 +00:00
|
|
|
TEST_F(TextToBinaryTest, TooManyArguments) {
|
|
|
|
const std::string input = R"(%opencl = OpExtInstImport "OpenCL.std"
|
|
|
|
%2 = OpExtInst %float %opencl cos %x %oops")";
|
|
|
|
EXPECT_THAT(CompileFailure(input), Eq("Expected '=', found end of stream."));
|
|
|
|
}
|
|
|
|
|
2015-11-09 23:55:42 +00:00
|
|
|
TEST_F(TextToBinaryTest, ExtInstFromTwoDifferentImports) {
|
|
|
|
const std::string input = R"(%1 = OpExtInstImport "OpenCL.std"
|
|
|
|
%2 = OpExtInstImport "GLSL.std.450"
|
|
|
|
%4 = OpExtInst %3 %1 native_sqrt %5
|
|
|
|
%7 = OpExtInst %6 %2 MatrixInverse %8
|
|
|
|
)";
|
|
|
|
|
|
|
|
// Make sure it assembles correctly.
|
|
|
|
EXPECT_THAT(
|
|
|
|
CompiledInstructions(input),
|
|
|
|
Eq(Concatenate({
|
|
|
|
MakeInstruction(SpvOpExtInstImport, {1}, MakeVector("OpenCL.std")),
|
|
|
|
MakeInstruction(SpvOpExtInstImport, {2}, MakeVector("GLSL.std.450")),
|
|
|
|
MakeInstruction(
|
|
|
|
SpvOpExtInst,
|
|
|
|
{3, 4, 1, uint32_t(OpenCLLIB::Entrypoints::Native_sqrt), 5}),
|
|
|
|
MakeInstruction(SpvOpExtInst,
|
|
|
|
{6, 7, 2, uint32_t(GLSLstd450MatrixInverse), 8}),
|
|
|
|
})));
|
|
|
|
|
|
|
|
// Make sure it disassembles correctly.
|
|
|
|
EXPECT_THAT(EncodeAndDecodeSuccessfully(input), Eq(input));
|
|
|
|
}
|
|
|
|
|
2016-09-16 18:40:02 +00:00
|
|
|
// A test case for assembling into words in an instruction.
|
|
|
|
struct AssemblyCase {
|
|
|
|
std::string input;
|
|
|
|
std::vector<uint32_t> expected;
|
|
|
|
};
|
|
|
|
|
2017-03-14 16:43:41 +00:00
|
|
|
using ExtensionAssemblyTest = spvtest::TextToBinaryTestBase<
|
|
|
|
::testing::TestWithParam<std::tuple<spv_target_env, AssemblyCase>>>;
|
|
|
|
|
|
|
|
TEST_P(ExtensionAssemblyTest, Samples) {
|
|
|
|
const spv_target_env& env = std::get<0>(GetParam());
|
|
|
|
const AssemblyCase& ac = std::get<1>(GetParam());
|
|
|
|
|
|
|
|
// Check that it assembles correctly.
|
|
|
|
EXPECT_THAT(CompiledInstructions(ac.input, env), Eq(ac.expected));
|
|
|
|
}
|
|
|
|
|
2016-10-12 14:47:28 +00:00
|
|
|
using ExtensionRoundTripTest = spvtest::TextToBinaryTestBase<
|
2016-09-16 18:40:02 +00:00
|
|
|
::testing::TestWithParam<std::tuple<spv_target_env, AssemblyCase>>>;
|
|
|
|
|
2016-10-12 14:47:28 +00:00
|
|
|
TEST_P(ExtensionRoundTripTest, Samples) {
|
2016-09-16 18:40:02 +00:00
|
|
|
const spv_target_env& env = std::get<0>(GetParam());
|
|
|
|
const AssemblyCase& ac = std::get<1>(GetParam());
|
|
|
|
|
|
|
|
// Check that it assembles correctly.
|
|
|
|
EXPECT_THAT(CompiledInstructions(ac.input, env), Eq(ac.expected));
|
|
|
|
|
|
|
|
// Check round trip through the disassembler.
|
|
|
|
EXPECT_THAT(EncodeAndDecodeSuccessfully(ac.input,
|
|
|
|
SPV_BINARY_TO_TEXT_OPTION_NONE, env),
|
2018-03-14 17:06:18 +00:00
|
|
|
Eq(ac.input))
|
|
|
|
<< "target env: " << spvTargetEnvDescription(env) << "\n";
|
2016-09-16 18:40:02 +00:00
|
|
|
}
|
|
|
|
|
2016-10-12 14:47:28 +00:00
|
|
|
// SPV_KHR_shader_ballot
|
|
|
|
|
2019-01-29 23:56:52 +00:00
|
|
|
INSTANTIATE_TEST_SUITE_P(
|
2016-10-12 14:47:28 +00:00
|
|
|
SPV_KHR_shader_ballot, ExtensionRoundTripTest,
|
2016-09-16 18:40:02 +00:00
|
|
|
// We'll get coverage over operand tables by trying the universal
|
|
|
|
// environments, and at least one specific environment.
|
|
|
|
Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1,
|
|
|
|
SPV_ENV_VULKAN_1_0),
|
|
|
|
ValuesIn(std::vector<AssemblyCase>{
|
|
|
|
{"OpCapability SubgroupBallotKHR\n",
|
|
|
|
MakeInstruction(SpvOpCapability,
|
|
|
|
{SpvCapabilitySubgroupBallotKHR})},
|
|
|
|
{"%2 = OpSubgroupBallotKHR %1 %3\n",
|
|
|
|
MakeInstruction(SpvOpSubgroupBallotKHR, {1, 2, 3})},
|
|
|
|
{"%2 = OpSubgroupFirstInvocationKHR %1 %3\n",
|
|
|
|
MakeInstruction(SpvOpSubgroupFirstInvocationKHR, {1, 2, 3})},
|
2018-06-06 06:07:51 +00:00
|
|
|
{"OpDecorate %1 BuiltIn SubgroupEqMask\n",
|
2016-09-16 18:40:02 +00:00
|
|
|
MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn,
|
|
|
|
SpvBuiltInSubgroupEqMaskKHR})},
|
2018-06-06 06:07:51 +00:00
|
|
|
{"OpDecorate %1 BuiltIn SubgroupGeMask\n",
|
2016-09-16 18:40:02 +00:00
|
|
|
MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn,
|
|
|
|
SpvBuiltInSubgroupGeMaskKHR})},
|
2018-06-06 06:07:51 +00:00
|
|
|
{"OpDecorate %1 BuiltIn SubgroupGtMask\n",
|
2016-09-16 18:40:02 +00:00
|
|
|
MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn,
|
|
|
|
SpvBuiltInSubgroupGtMaskKHR})},
|
2018-06-06 06:07:51 +00:00
|
|
|
{"OpDecorate %1 BuiltIn SubgroupLeMask\n",
|
2016-09-16 18:40:02 +00:00
|
|
|
MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn,
|
|
|
|
SpvBuiltInSubgroupLeMaskKHR})},
|
2018-06-06 06:07:51 +00:00
|
|
|
{"OpDecorate %1 BuiltIn SubgroupLtMask\n",
|
2016-09-16 18:40:02 +00:00
|
|
|
MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn,
|
|
|
|
SpvBuiltInSubgroupLtMaskKHR})},
|
2019-01-29 23:56:52 +00:00
|
|
|
})));
|
2016-09-16 18:40:02 +00:00
|
|
|
|
2019-01-29 23:56:52 +00:00
|
|
|
INSTANTIATE_TEST_SUITE_P(
|
2018-02-09 19:29:02 +00:00
|
|
|
SPV_KHR_shader_ballot_vulkan_1_1, ExtensionRoundTripTest,
|
|
|
|
// In SPIR-V 1.3 and Vulkan 1.1 we can drop the KHR suffix on the
|
|
|
|
// builtin enums.
|
|
|
|
Combine(Values(SPV_ENV_UNIVERSAL_1_3, SPV_ENV_VULKAN_1_1),
|
|
|
|
ValuesIn(std::vector<AssemblyCase>{
|
|
|
|
{"OpCapability SubgroupBallotKHR\n",
|
|
|
|
MakeInstruction(SpvOpCapability,
|
|
|
|
{SpvCapabilitySubgroupBallotKHR})},
|
|
|
|
{"%2 = OpSubgroupBallotKHR %1 %3\n",
|
|
|
|
MakeInstruction(SpvOpSubgroupBallotKHR, {1, 2, 3})},
|
|
|
|
{"%2 = OpSubgroupFirstInvocationKHR %1 %3\n",
|
|
|
|
MakeInstruction(SpvOpSubgroupFirstInvocationKHR, {1, 2, 3})},
|
|
|
|
{"OpDecorate %1 BuiltIn SubgroupEqMask\n",
|
|
|
|
MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn,
|
|
|
|
SpvBuiltInSubgroupEqMask})},
|
|
|
|
{"OpDecorate %1 BuiltIn SubgroupGeMask\n",
|
|
|
|
MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn,
|
|
|
|
SpvBuiltInSubgroupGeMask})},
|
|
|
|
{"OpDecorate %1 BuiltIn SubgroupGtMask\n",
|
|
|
|
MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn,
|
|
|
|
SpvBuiltInSubgroupGtMask})},
|
|
|
|
{"OpDecorate %1 BuiltIn SubgroupLeMask\n",
|
|
|
|
MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn,
|
|
|
|
SpvBuiltInSubgroupLeMask})},
|
|
|
|
{"OpDecorate %1 BuiltIn SubgroupLtMask\n",
|
|
|
|
MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn,
|
|
|
|
SpvBuiltInSubgroupLtMask})},
|
2019-01-29 23:56:52 +00:00
|
|
|
})));
|
2018-02-09 19:29:02 +00:00
|
|
|
|
|
|
|
// The old builtin names (with KHR suffix) still work in the assmebler, and
|
|
|
|
// map to the enums without the KHR.
|
2019-01-29 23:56:52 +00:00
|
|
|
INSTANTIATE_TEST_SUITE_P(
|
2018-02-09 19:29:02 +00:00
|
|
|
SPV_KHR_shader_ballot_vulkan_1_1_alias_check, ExtensionAssemblyTest,
|
|
|
|
// In SPIR-V 1.3 and Vulkan 1.1 we can drop the KHR suffix on the
|
|
|
|
// builtin enums.
|
|
|
|
Combine(Values(SPV_ENV_UNIVERSAL_1_3, SPV_ENV_VULKAN_1_1),
|
|
|
|
ValuesIn(std::vector<AssemblyCase>{
|
|
|
|
{"OpDecorate %1 BuiltIn SubgroupEqMaskKHR\n",
|
|
|
|
MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn,
|
|
|
|
SpvBuiltInSubgroupEqMask})},
|
|
|
|
{"OpDecorate %1 BuiltIn SubgroupGeMaskKHR\n",
|
|
|
|
MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn,
|
|
|
|
SpvBuiltInSubgroupGeMask})},
|
|
|
|
{"OpDecorate %1 BuiltIn SubgroupGtMaskKHR\n",
|
|
|
|
MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn,
|
|
|
|
SpvBuiltInSubgroupGtMask})},
|
|
|
|
{"OpDecorate %1 BuiltIn SubgroupLeMaskKHR\n",
|
|
|
|
MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn,
|
|
|
|
SpvBuiltInSubgroupLeMask})},
|
|
|
|
{"OpDecorate %1 BuiltIn SubgroupLtMaskKHR\n",
|
|
|
|
MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn,
|
|
|
|
SpvBuiltInSubgroupLtMask})},
|
2019-01-29 23:56:52 +00:00
|
|
|
})));
|
2018-02-09 19:29:02 +00:00
|
|
|
|
2016-10-12 14:47:28 +00:00
|
|
|
// SPV_KHR_shader_draw_parameters
|
|
|
|
|
2019-01-29 23:56:52 +00:00
|
|
|
INSTANTIATE_TEST_SUITE_P(
|
2016-10-12 14:47:28 +00:00
|
|
|
SPV_KHR_shader_draw_parameters, ExtensionRoundTripTest,
|
|
|
|
// We'll get coverage over operand tables by trying the universal
|
|
|
|
// environments, and at least one specific environment.
|
|
|
|
Combine(
|
2018-02-09 19:29:02 +00:00
|
|
|
ValuesIn(CommonVulkanEnvs()),
|
2016-10-12 14:47:28 +00:00
|
|
|
ValuesIn(std::vector<AssemblyCase>{
|
|
|
|
{"OpCapability DrawParameters\n",
|
|
|
|
MakeInstruction(SpvOpCapability, {SpvCapabilityDrawParameters})},
|
|
|
|
{"OpDecorate %1 BuiltIn BaseVertex\n",
|
|
|
|
MakeInstruction(SpvOpDecorate,
|
|
|
|
{1, SpvDecorationBuiltIn, SpvBuiltInBaseVertex})},
|
|
|
|
{"OpDecorate %1 BuiltIn BaseInstance\n",
|
|
|
|
MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn,
|
|
|
|
SpvBuiltInBaseInstance})},
|
|
|
|
{"OpDecorate %1 BuiltIn DrawIndex\n",
|
|
|
|
MakeInstruction(SpvOpDecorate,
|
|
|
|
{1, SpvDecorationBuiltIn, SpvBuiltInDrawIndex})},
|
2019-01-29 23:56:52 +00:00
|
|
|
})));
|
2016-10-12 14:47:28 +00:00
|
|
|
|
2017-01-26 23:26:20 +00:00
|
|
|
// SPV_KHR_subgroup_vote
|
|
|
|
|
2019-01-29 23:56:52 +00:00
|
|
|
INSTANTIATE_TEST_SUITE_P(
|
2017-01-26 23:26:20 +00:00
|
|
|
SPV_KHR_subgroup_vote, ExtensionRoundTripTest,
|
|
|
|
// We'll get coverage over operand tables by trying the universal
|
|
|
|
// environments, and at least one specific environment.
|
2018-02-09 19:29:02 +00:00
|
|
|
Combine(ValuesIn(CommonVulkanEnvs()),
|
2017-11-27 15:16:41 +00:00
|
|
|
ValuesIn(std::vector<AssemblyCase>{
|
|
|
|
{"OpCapability SubgroupVoteKHR\n",
|
|
|
|
MakeInstruction(SpvOpCapability,
|
|
|
|
{SpvCapabilitySubgroupVoteKHR})},
|
|
|
|
{"%2 = OpSubgroupAnyKHR %1 %3\n",
|
|
|
|
MakeInstruction(SpvOpSubgroupAnyKHR, {1, 2, 3})},
|
|
|
|
{"%2 = OpSubgroupAllKHR %1 %3\n",
|
|
|
|
MakeInstruction(SpvOpSubgroupAllKHR, {1, 2, 3})},
|
|
|
|
{"%2 = OpSubgroupAllEqualKHR %1 %3\n",
|
|
|
|
MakeInstruction(SpvOpSubgroupAllEqualKHR, {1, 2, 3})},
|
2019-01-29 23:56:52 +00:00
|
|
|
})));
|
2017-01-26 23:26:20 +00:00
|
|
|
|
2017-01-27 01:02:24 +00:00
|
|
|
// SPV_KHR_16bit_storage
|
|
|
|
|
2019-01-29 23:56:52 +00:00
|
|
|
INSTANTIATE_TEST_SUITE_P(
|
2017-01-27 01:02:24 +00:00
|
|
|
SPV_KHR_16bit_storage, ExtensionRoundTripTest,
|
|
|
|
// We'll get coverage over operand tables by trying the universal
|
|
|
|
// environments, and at least one specific environment.
|
2018-02-09 19:29:02 +00:00
|
|
|
Combine(ValuesIn(CommonVulkanEnvs()),
|
2017-01-27 01:02:24 +00:00
|
|
|
ValuesIn(std::vector<AssemblyCase>{
|
2017-03-26 01:12:22 +00:00
|
|
|
{"OpCapability StorageBuffer16BitAccess\n",
|
2017-01-27 01:02:24 +00:00
|
|
|
MakeInstruction(SpvOpCapability,
|
|
|
|
{SpvCapabilityStorageUniformBufferBlock16})},
|
2017-03-26 01:12:22 +00:00
|
|
|
{"OpCapability StorageBuffer16BitAccess\n",
|
|
|
|
MakeInstruction(SpvOpCapability,
|
|
|
|
{SpvCapabilityStorageBuffer16BitAccess})},
|
2019-05-07 16:27:18 +00:00
|
|
|
{"OpCapability UniformAndStorageBuffer16BitAccess\n",
|
2017-03-26 01:12:22 +00:00
|
|
|
MakeInstruction(
|
|
|
|
SpvOpCapability,
|
|
|
|
{SpvCapabilityUniformAndStorageBuffer16BitAccess})},
|
2019-05-07 16:27:18 +00:00
|
|
|
{"OpCapability UniformAndStorageBuffer16BitAccess\n",
|
2017-01-27 01:02:24 +00:00
|
|
|
MakeInstruction(SpvOpCapability,
|
|
|
|
{SpvCapabilityStorageUniform16})},
|
|
|
|
{"OpCapability StoragePushConstant16\n",
|
|
|
|
MakeInstruction(SpvOpCapability,
|
|
|
|
{SpvCapabilityStoragePushConstant16})},
|
|
|
|
{"OpCapability StorageInputOutput16\n",
|
|
|
|
MakeInstruction(SpvOpCapability,
|
|
|
|
{SpvCapabilityStorageInputOutput16})},
|
2019-01-29 23:56:52 +00:00
|
|
|
})));
|
2017-01-27 01:02:24 +00:00
|
|
|
|
2019-01-29 23:56:52 +00:00
|
|
|
INSTANTIATE_TEST_SUITE_P(
|
2017-03-14 16:43:41 +00:00
|
|
|
SPV_KHR_16bit_storage_alias_check, ExtensionAssemblyTest,
|
2018-02-09 19:29:02 +00:00
|
|
|
Combine(ValuesIn(CommonVulkanEnvs()),
|
2017-03-14 16:43:41 +00:00
|
|
|
ValuesIn(std::vector<AssemblyCase>{
|
|
|
|
// The old name maps to the new enum.
|
|
|
|
{"OpCapability StorageUniformBufferBlock16\n",
|
|
|
|
MakeInstruction(SpvOpCapability,
|
|
|
|
{SpvCapabilityStorageBuffer16BitAccess})},
|
2018-03-14 17:06:18 +00:00
|
|
|
// The new name maps to the old enum.
|
|
|
|
{"OpCapability UniformAndStorageBuffer16BitAccess\n",
|
|
|
|
MakeInstruction(SpvOpCapability,
|
|
|
|
{SpvCapabilityStorageUniform16})},
|
2019-01-29 23:56:52 +00:00
|
|
|
})));
|
2017-03-14 16:43:41 +00:00
|
|
|
|
2017-01-27 01:05:01 +00:00
|
|
|
// SPV_KHR_device_group
|
|
|
|
|
2019-01-29 23:56:52 +00:00
|
|
|
INSTANTIATE_TEST_SUITE_P(
|
2017-01-27 01:05:01 +00:00
|
|
|
SPV_KHR_device_group, ExtensionRoundTripTest,
|
|
|
|
// We'll get coverage over operand tables by trying the universal
|
|
|
|
// environments, and at least one specific environment.
|
2018-02-09 19:29:02 +00:00
|
|
|
Combine(ValuesIn(CommonVulkanEnvs()),
|
2017-01-27 01:05:01 +00:00
|
|
|
ValuesIn(std::vector<AssemblyCase>{
|
|
|
|
{"OpCapability DeviceGroup\n",
|
|
|
|
MakeInstruction(SpvOpCapability, {SpvCapabilityDeviceGroup})},
|
|
|
|
{"OpDecorate %1 BuiltIn DeviceIndex\n",
|
|
|
|
MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn,
|
|
|
|
SpvBuiltInDeviceIndex})},
|
2019-01-29 23:56:52 +00:00
|
|
|
})));
|
2017-01-27 01:05:01 +00:00
|
|
|
|
2018-06-01 19:19:11 +00:00
|
|
|
// SPV_KHR_8bit_storage
|
|
|
|
|
2019-01-29 23:56:52 +00:00
|
|
|
INSTANTIATE_TEST_SUITE_P(
|
2018-06-01 19:19:11 +00:00
|
|
|
SPV_KHR_8bit_storage, ExtensionRoundTripTest,
|
|
|
|
// We'll get coverage over operand tables by trying the universal
|
|
|
|
// environments, and at least one specific environment.
|
|
|
|
Combine(
|
|
|
|
ValuesIn(CommonVulkanEnvs()),
|
|
|
|
ValuesIn(std::vector<AssemblyCase>{
|
|
|
|
{"OpCapability StorageBuffer8BitAccess\n",
|
|
|
|
MakeInstruction(SpvOpCapability,
|
|
|
|
{SpvCapabilityStorageBuffer8BitAccess})},
|
|
|
|
{"OpCapability UniformAndStorageBuffer8BitAccess\n",
|
|
|
|
MakeInstruction(SpvOpCapability,
|
|
|
|
{SpvCapabilityUniformAndStorageBuffer8BitAccess})},
|
|
|
|
{"OpCapability StoragePushConstant8\n",
|
|
|
|
MakeInstruction(SpvOpCapability,
|
|
|
|
{SpvCapabilityStoragePushConstant8})},
|
2019-01-29 23:56:52 +00:00
|
|
|
})));
|
2018-06-01 19:19:11 +00:00
|
|
|
|
2017-01-27 01:12:15 +00:00
|
|
|
// SPV_KHR_multiview
|
|
|
|
|
2019-01-29 23:56:52 +00:00
|
|
|
INSTANTIATE_TEST_SUITE_P(
|
2017-01-27 01:12:15 +00:00
|
|
|
SPV_KHR_multiview, ExtensionRoundTripTest,
|
|
|
|
// We'll get coverage over operand tables by trying the universal
|
|
|
|
// environments, and at least one specific environment.
|
|
|
|
Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1,
|
|
|
|
SPV_ENV_VULKAN_1_0),
|
|
|
|
ValuesIn(std::vector<AssemblyCase>{
|
|
|
|
{"OpCapability MultiView\n",
|
|
|
|
MakeInstruction(SpvOpCapability, {SpvCapabilityMultiView})},
|
|
|
|
{"OpDecorate %1 BuiltIn ViewIndex\n",
|
|
|
|
MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn,
|
|
|
|
SpvBuiltInViewIndex})},
|
2019-01-29 23:56:52 +00:00
|
|
|
})));
|
2017-01-27 01:12:15 +00:00
|
|
|
|
2017-06-21 07:58:00 +00:00
|
|
|
// SPV_AMD_shader_explicit_vertex_parameter
|
|
|
|
|
2017-11-27 15:16:41 +00:00
|
|
|
#define PREAMBLE \
|
|
|
|
"%1 = OpExtInstImport \"SPV_AMD_shader_explicit_vertex_parameter\"\n"
|
2019-01-29 23:56:52 +00:00
|
|
|
INSTANTIATE_TEST_SUITE_P(
|
2017-06-21 07:58:00 +00:00
|
|
|
SPV_AMD_shader_explicit_vertex_parameter, ExtensionRoundTripTest,
|
|
|
|
// We'll get coverage over operand tables by trying the universal
|
|
|
|
// environments, and at least one specific environment.
|
2017-11-27 15:16:41 +00:00
|
|
|
Combine(
|
|
|
|
Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1,
|
|
|
|
SPV_ENV_VULKAN_1_0),
|
|
|
|
ValuesIn(std::vector<AssemblyCase>{
|
|
|
|
{PREAMBLE "%3 = OpExtInst %2 %1 InterpolateAtVertexAMD %4 %5\n",
|
|
|
|
Concatenate(
|
|
|
|
{MakeInstruction(
|
|
|
|
SpvOpExtInstImport, {1},
|
|
|
|
MakeVector("SPV_AMD_shader_explicit_vertex_parameter")),
|
|
|
|
MakeInstruction(SpvOpExtInst, {2, 3, 1, 1, 4, 5})})},
|
2019-01-29 23:56:52 +00:00
|
|
|
})));
|
2017-06-21 07:58:00 +00:00
|
|
|
#undef PREAMBLE
|
|
|
|
|
|
|
|
// SPV_AMD_shader_trinary_minmax
|
|
|
|
|
|
|
|
#define PREAMBLE "%1 = OpExtInstImport \"SPV_AMD_shader_trinary_minmax\"\n"
|
2019-01-29 23:56:52 +00:00
|
|
|
INSTANTIATE_TEST_SUITE_P(
|
2017-06-21 07:58:00 +00:00
|
|
|
SPV_AMD_shader_trinary_minmax, ExtensionRoundTripTest,
|
|
|
|
// We'll get coverage over operand tables by trying the universal
|
|
|
|
// environments, and at least one specific environment.
|
2017-11-27 15:16:41 +00:00
|
|
|
Combine(
|
|
|
|
Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1,
|
|
|
|
SPV_ENV_VULKAN_1_0),
|
|
|
|
ValuesIn(std::vector<AssemblyCase>{
|
|
|
|
{PREAMBLE "%3 = OpExtInst %2 %1 FMin3AMD %4 %5 %6\n",
|
|
|
|
Concatenate(
|
|
|
|
{MakeInstruction(SpvOpExtInstImport, {1},
|
|
|
|
MakeVector("SPV_AMD_shader_trinary_minmax")),
|
|
|
|
MakeInstruction(SpvOpExtInst, {2, 3, 1, 1, 4, 5, 6})})},
|
|
|
|
{PREAMBLE "%3 = OpExtInst %2 %1 UMin3AMD %4 %5 %6\n",
|
|
|
|
Concatenate(
|
|
|
|
{MakeInstruction(SpvOpExtInstImport, {1},
|
|
|
|
MakeVector("SPV_AMD_shader_trinary_minmax")),
|
|
|
|
MakeInstruction(SpvOpExtInst, {2, 3, 1, 2, 4, 5, 6})})},
|
|
|
|
{PREAMBLE "%3 = OpExtInst %2 %1 SMin3AMD %4 %5 %6\n",
|
|
|
|
Concatenate(
|
|
|
|
{MakeInstruction(SpvOpExtInstImport, {1},
|
|
|
|
MakeVector("SPV_AMD_shader_trinary_minmax")),
|
|
|
|
MakeInstruction(SpvOpExtInst, {2, 3, 1, 3, 4, 5, 6})})},
|
|
|
|
{PREAMBLE "%3 = OpExtInst %2 %1 FMax3AMD %4 %5 %6\n",
|
|
|
|
Concatenate(
|
|
|
|
{MakeInstruction(SpvOpExtInstImport, {1},
|
|
|
|
MakeVector("SPV_AMD_shader_trinary_minmax")),
|
|
|
|
MakeInstruction(SpvOpExtInst, {2, 3, 1, 4, 4, 5, 6})})},
|
|
|
|
{PREAMBLE "%3 = OpExtInst %2 %1 UMax3AMD %4 %5 %6\n",
|
|
|
|
Concatenate(
|
|
|
|
{MakeInstruction(SpvOpExtInstImport, {1},
|
|
|
|
MakeVector("SPV_AMD_shader_trinary_minmax")),
|
|
|
|
MakeInstruction(SpvOpExtInst, {2, 3, 1, 5, 4, 5, 6})})},
|
|
|
|
{PREAMBLE "%3 = OpExtInst %2 %1 SMax3AMD %4 %5 %6\n",
|
|
|
|
Concatenate(
|
|
|
|
{MakeInstruction(SpvOpExtInstImport, {1},
|
|
|
|
MakeVector("SPV_AMD_shader_trinary_minmax")),
|
|
|
|
MakeInstruction(SpvOpExtInst, {2, 3, 1, 6, 4, 5, 6})})},
|
|
|
|
{PREAMBLE "%3 = OpExtInst %2 %1 FMid3AMD %4 %5 %6\n",
|
|
|
|
Concatenate(
|
|
|
|
{MakeInstruction(SpvOpExtInstImport, {1},
|
|
|
|
MakeVector("SPV_AMD_shader_trinary_minmax")),
|
|
|
|
MakeInstruction(SpvOpExtInst, {2, 3, 1, 7, 4, 5, 6})})},
|
|
|
|
{PREAMBLE "%3 = OpExtInst %2 %1 UMid3AMD %4 %5 %6\n",
|
|
|
|
Concatenate(
|
|
|
|
{MakeInstruction(SpvOpExtInstImport, {1},
|
|
|
|
MakeVector("SPV_AMD_shader_trinary_minmax")),
|
|
|
|
MakeInstruction(SpvOpExtInst, {2, 3, 1, 8, 4, 5, 6})})},
|
|
|
|
{PREAMBLE "%3 = OpExtInst %2 %1 SMid3AMD %4 %5 %6\n",
|
|
|
|
Concatenate(
|
|
|
|
{MakeInstruction(SpvOpExtInstImport, {1},
|
|
|
|
MakeVector("SPV_AMD_shader_trinary_minmax")),
|
|
|
|
MakeInstruction(SpvOpExtInst, {2, 3, 1, 9, 4, 5, 6})})},
|
2019-01-29 23:56:52 +00:00
|
|
|
})));
|
2017-06-21 07:58:00 +00:00
|
|
|
#undef PREAMBLE
|
|
|
|
|
2017-03-21 16:43:26 +00:00
|
|
|
// SPV_AMD_gcn_shader
|
|
|
|
|
|
|
|
#define PREAMBLE "%1 = OpExtInstImport \"SPV_AMD_gcn_shader\"\n"
|
2019-01-29 23:56:52 +00:00
|
|
|
INSTANTIATE_TEST_SUITE_P(
|
2017-03-21 16:43:26 +00:00
|
|
|
SPV_AMD_gcn_shader, ExtensionRoundTripTest,
|
|
|
|
// We'll get coverage over operand tables by trying the universal
|
|
|
|
// environments, and at least one specific environment.
|
|
|
|
Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1,
|
|
|
|
SPV_ENV_VULKAN_1_0),
|
|
|
|
ValuesIn(std::vector<AssemblyCase>{
|
|
|
|
{PREAMBLE "%3 = OpExtInst %2 %1 CubeFaceIndexAMD %4\n",
|
|
|
|
Concatenate({MakeInstruction(SpvOpExtInstImport, {1},
|
|
|
|
MakeVector("SPV_AMD_gcn_shader")),
|
|
|
|
MakeInstruction(SpvOpExtInst, {2, 3, 1, 1, 4})})},
|
2017-06-21 07:58:00 +00:00
|
|
|
{PREAMBLE "%3 = OpExtInst %2 %1 CubeFaceCoordAMD %4\n",
|
|
|
|
Concatenate({MakeInstruction(SpvOpExtInstImport, {1},
|
|
|
|
MakeVector("SPV_AMD_gcn_shader")),
|
|
|
|
MakeInstruction(SpvOpExtInst, {2, 3, 1, 2, 4})})},
|
2017-03-21 16:43:26 +00:00
|
|
|
{PREAMBLE "%3 = OpExtInst %2 %1 TimeAMD\n",
|
|
|
|
Concatenate({MakeInstruction(SpvOpExtInstImport, {1},
|
|
|
|
MakeVector("SPV_AMD_gcn_shader")),
|
|
|
|
MakeInstruction(SpvOpExtInst, {2, 3, 1, 3})})},
|
2019-01-29 23:56:52 +00:00
|
|
|
})));
|
2017-03-21 16:43:26 +00:00
|
|
|
#undef PREAMBLE
|
|
|
|
|
2017-06-21 07:58:00 +00:00
|
|
|
// SPV_AMD_shader_ballot
|
|
|
|
|
|
|
|
#define PREAMBLE "%1 = OpExtInstImport \"SPV_AMD_shader_ballot\"\n"
|
2019-01-29 23:56:52 +00:00
|
|
|
INSTANTIATE_TEST_SUITE_P(
|
2017-06-21 07:58:00 +00:00
|
|
|
SPV_AMD_shader_ballot, ExtensionRoundTripTest,
|
|
|
|
// We'll get coverage over operand tables by trying the universal
|
|
|
|
// environments, and at least one specific environment.
|
2017-11-27 15:16:41 +00:00
|
|
|
Combine(
|
|
|
|
Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1,
|
|
|
|
SPV_ENV_VULKAN_1_0),
|
|
|
|
ValuesIn(std::vector<AssemblyCase>{
|
|
|
|
{PREAMBLE "%3 = OpExtInst %2 %1 SwizzleInvocationsAMD %4 %5\n",
|
|
|
|
Concatenate({MakeInstruction(SpvOpExtInstImport, {1},
|
|
|
|
MakeVector("SPV_AMD_shader_ballot")),
|
|
|
|
MakeInstruction(SpvOpExtInst, {2, 3, 1, 1, 4, 5})})},
|
|
|
|
{PREAMBLE
|
|
|
|
"%3 = OpExtInst %2 %1 SwizzleInvocationsMaskedAMD %4 %5\n",
|
|
|
|
Concatenate({MakeInstruction(SpvOpExtInstImport, {1},
|
|
|
|
MakeVector("SPV_AMD_shader_ballot")),
|
|
|
|
MakeInstruction(SpvOpExtInst, {2, 3, 1, 2, 4, 5})})},
|
|
|
|
{PREAMBLE "%3 = OpExtInst %2 %1 WriteInvocationAMD %4 %5 %6\n",
|
|
|
|
Concatenate({MakeInstruction(SpvOpExtInstImport, {1},
|
|
|
|
MakeVector("SPV_AMD_shader_ballot")),
|
|
|
|
MakeInstruction(SpvOpExtInst,
|
|
|
|
{2, 3, 1, 3, 4, 5, 6})})},
|
|
|
|
{PREAMBLE "%3 = OpExtInst %2 %1 MbcntAMD %4\n",
|
|
|
|
Concatenate({MakeInstruction(SpvOpExtInstImport, {1},
|
|
|
|
MakeVector("SPV_AMD_shader_ballot")),
|
|
|
|
MakeInstruction(SpvOpExtInst, {2, 3, 1, 4, 4})})},
|
2019-01-29 23:56:52 +00:00
|
|
|
})));
|
2017-06-21 07:58:00 +00:00
|
|
|
#undef PREAMBLE
|
|
|
|
|
2017-03-08 22:16:04 +00:00
|
|
|
// SPV_KHR_variable_pointers
|
|
|
|
|
2019-01-29 23:56:52 +00:00
|
|
|
INSTANTIATE_TEST_SUITE_P(
|
2017-03-08 22:16:04 +00:00
|
|
|
SPV_KHR_variable_pointers, ExtensionRoundTripTest,
|
|
|
|
// We'll get coverage over operand tables by trying the universal
|
|
|
|
// environments, and at least one specific environment.
|
|
|
|
Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1,
|
|
|
|
SPV_ENV_VULKAN_1_0),
|
|
|
|
ValuesIn(std::vector<AssemblyCase>{
|
|
|
|
{"OpCapability VariablePointers\n",
|
|
|
|
MakeInstruction(SpvOpCapability,
|
|
|
|
{SpvCapabilityVariablePointers})},
|
2017-03-26 01:12:22 +00:00
|
|
|
{"OpCapability VariablePointersStorageBuffer\n",
|
2017-11-27 15:16:41 +00:00
|
|
|
MakeInstruction(SpvOpCapability,
|
|
|
|
{SpvCapabilityVariablePointersStorageBuffer})},
|
2019-01-29 23:56:52 +00:00
|
|
|
})));
|
2017-03-08 22:16:04 +00:00
|
|
|
|
2018-06-01 22:28:26 +00:00
|
|
|
// SPV_KHR_vulkan_memory_model
|
|
|
|
|
2019-01-29 23:56:52 +00:00
|
|
|
INSTANTIATE_TEST_SUITE_P(
|
2018-06-01 22:28:26 +00:00
|
|
|
SPV_KHR_vulkan_memory_model, ExtensionRoundTripTest,
|
|
|
|
// We'll get coverage over operand tables by trying the universal
|
|
|
|
// environments, and at least one specific environment.
|
|
|
|
//
|
|
|
|
// Note: SPV_KHR_vulkan_memory_model adds scope enum value QueueFamilyKHR.
|
2018-09-05 19:42:21 +00:00
|
|
|
// Scope enums are used in ID definitions elsewhere, that don't know they
|
|
|
|
// are using particular enums. So the assembler doesn't support assembling
|
|
|
|
// those enums names into the corresponding values. So there is no asm/dis
|
|
|
|
// tests for those enums.
|
2018-06-01 22:28:26 +00:00
|
|
|
Combine(
|
|
|
|
Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1,
|
|
|
|
SPV_ENV_UNIVERSAL_1_3, SPV_ENV_VULKAN_1_0, SPV_ENV_VULKAN_1_1),
|
|
|
|
ValuesIn(std::vector<AssemblyCase>{
|
|
|
|
{"OpCapability VulkanMemoryModelKHR\n",
|
|
|
|
MakeInstruction(SpvOpCapability,
|
|
|
|
{SpvCapabilityVulkanMemoryModelKHR})},
|
|
|
|
{"OpCapability VulkanMemoryModelDeviceScopeKHR\n",
|
|
|
|
MakeInstruction(SpvOpCapability,
|
|
|
|
{SpvCapabilityVulkanMemoryModelDeviceScopeKHR})},
|
|
|
|
{"OpMemoryModel Logical VulkanKHR\n",
|
|
|
|
MakeInstruction(SpvOpMemoryModel, {SpvAddressingModelLogical,
|
|
|
|
SpvMemoryModelVulkanKHR})},
|
|
|
|
{"OpStore %1 %2 MakePointerAvailableKHR %3\n",
|
|
|
|
MakeInstruction(SpvOpStore,
|
|
|
|
{1, 2, SpvMemoryAccessMakePointerAvailableKHRMask,
|
|
|
|
3})},
|
|
|
|
{"OpStore %1 %2 Volatile|MakePointerAvailableKHR %3\n",
|
|
|
|
MakeInstruction(SpvOpStore,
|
|
|
|
{1, 2,
|
|
|
|
int(SpvMemoryAccessMakePointerAvailableKHRMask) |
|
|
|
|
int(SpvMemoryAccessVolatileMask),
|
|
|
|
3})},
|
|
|
|
{"OpStore %1 %2 Aligned|MakePointerAvailableKHR 4 %3\n",
|
|
|
|
MakeInstruction(SpvOpStore,
|
|
|
|
{1, 2,
|
|
|
|
int(SpvMemoryAccessMakePointerAvailableKHRMask) |
|
|
|
|
int(SpvMemoryAccessAlignedMask),
|
|
|
|
4, 3})},
|
|
|
|
{"OpStore %1 %2 MakePointerAvailableKHR|NonPrivatePointerKHR %3\n",
|
|
|
|
MakeInstruction(SpvOpStore,
|
|
|
|
{1, 2,
|
|
|
|
int(SpvMemoryAccessMakePointerAvailableKHRMask) |
|
|
|
|
int(SpvMemoryAccessNonPrivatePointerKHRMask),
|
|
|
|
3})},
|
|
|
|
{"%2 = OpLoad %1 %3 MakePointerVisibleKHR %4\n",
|
|
|
|
MakeInstruction(SpvOpLoad,
|
|
|
|
{1, 2, 3, SpvMemoryAccessMakePointerVisibleKHRMask,
|
|
|
|
4})},
|
|
|
|
{"%2 = OpLoad %1 %3 Volatile|MakePointerVisibleKHR %4\n",
|
|
|
|
MakeInstruction(SpvOpLoad,
|
|
|
|
{1, 2, 3,
|
|
|
|
int(SpvMemoryAccessMakePointerVisibleKHRMask) |
|
|
|
|
int(SpvMemoryAccessVolatileMask),
|
|
|
|
4})},
|
|
|
|
{"%2 = OpLoad %1 %3 Aligned|MakePointerVisibleKHR 8 %4\n",
|
|
|
|
MakeInstruction(SpvOpLoad,
|
|
|
|
{1, 2, 3,
|
|
|
|
int(SpvMemoryAccessMakePointerVisibleKHRMask) |
|
|
|
|
int(SpvMemoryAccessAlignedMask),
|
|
|
|
8, 4})},
|
|
|
|
{"%2 = OpLoad %1 %3 MakePointerVisibleKHR|NonPrivatePointerKHR "
|
|
|
|
"%4\n",
|
|
|
|
MakeInstruction(SpvOpLoad,
|
|
|
|
{1, 2, 3,
|
|
|
|
int(SpvMemoryAccessMakePointerVisibleKHRMask) |
|
|
|
|
int(SpvMemoryAccessNonPrivatePointerKHRMask),
|
|
|
|
4})},
|
|
|
|
{"OpCopyMemory %1 %2 "
|
|
|
|
"MakePointerAvailableKHR|"
|
|
|
|
"MakePointerVisibleKHR|"
|
|
|
|
"NonPrivatePointerKHR "
|
|
|
|
"%3 %4\n",
|
|
|
|
MakeInstruction(SpvOpCopyMemory,
|
|
|
|
{1, 2,
|
|
|
|
(int(SpvMemoryAccessMakePointerVisibleKHRMask) |
|
|
|
|
int(SpvMemoryAccessMakePointerAvailableKHRMask) |
|
|
|
|
int(SpvMemoryAccessNonPrivatePointerKHRMask)),
|
|
|
|
3, 4})},
|
|
|
|
{"OpCopyMemorySized %1 %2 %3 "
|
|
|
|
"MakePointerAvailableKHR|"
|
|
|
|
"MakePointerVisibleKHR|"
|
|
|
|
"NonPrivatePointerKHR "
|
|
|
|
"%4 %5\n",
|
|
|
|
MakeInstruction(SpvOpCopyMemorySized,
|
|
|
|
{1, 2, 3,
|
|
|
|
(int(SpvMemoryAccessMakePointerVisibleKHRMask) |
|
|
|
|
int(SpvMemoryAccessMakePointerAvailableKHRMask) |
|
|
|
|
int(SpvMemoryAccessNonPrivatePointerKHRMask)),
|
|
|
|
4, 5})},
|
|
|
|
// Image operands
|
|
|
|
{"OpImageWrite %1 %2 %3 MakeTexelAvailableKHR "
|
|
|
|
"%4\n",
|
|
|
|
MakeInstruction(
|
|
|
|
SpvOpImageWrite,
|
|
|
|
{1, 2, 3, int(SpvImageOperandsMakeTexelAvailableKHRMask), 4})},
|
|
|
|
{"OpImageWrite %1 %2 %3 MakeTexelAvailableKHR|NonPrivateTexelKHR "
|
|
|
|
"%4\n",
|
|
|
|
MakeInstruction(SpvOpImageWrite,
|
|
|
|
{1, 2, 3,
|
|
|
|
int(SpvImageOperandsMakeTexelAvailableKHRMask) |
|
|
|
|
int(SpvImageOperandsNonPrivateTexelKHRMask),
|
|
|
|
4})},
|
|
|
|
{"OpImageWrite %1 %2 %3 "
|
|
|
|
"MakeTexelAvailableKHR|NonPrivateTexelKHR|VolatileTexelKHR "
|
|
|
|
"%4\n",
|
|
|
|
MakeInstruction(SpvOpImageWrite,
|
|
|
|
{1, 2, 3,
|
|
|
|
int(SpvImageOperandsMakeTexelAvailableKHRMask) |
|
|
|
|
int(SpvImageOperandsNonPrivateTexelKHRMask) |
|
|
|
|
int(SpvImageOperandsVolatileTexelKHRMask),
|
|
|
|
4})},
|
|
|
|
{"%2 = OpImageRead %1 %3 %4 MakeTexelVisibleKHR "
|
|
|
|
"%5\n",
|
|
|
|
MakeInstruction(SpvOpImageRead,
|
|
|
|
{1, 2, 3, 4,
|
|
|
|
int(SpvImageOperandsMakeTexelVisibleKHRMask),
|
|
|
|
5})},
|
|
|
|
{"%2 = OpImageRead %1 %3 %4 "
|
|
|
|
"MakeTexelVisibleKHR|NonPrivateTexelKHR "
|
|
|
|
"%5\n",
|
|
|
|
MakeInstruction(SpvOpImageRead,
|
|
|
|
{1, 2, 3, 4,
|
|
|
|
int(SpvImageOperandsMakeTexelVisibleKHRMask) |
|
|
|
|
int(SpvImageOperandsNonPrivateTexelKHRMask),
|
|
|
|
5})},
|
|
|
|
{"%2 = OpImageRead %1 %3 %4 "
|
|
|
|
"MakeTexelVisibleKHR|NonPrivateTexelKHR|VolatileTexelKHR "
|
|
|
|
"%5\n",
|
|
|
|
MakeInstruction(SpvOpImageRead,
|
|
|
|
{1, 2, 3, 4,
|
|
|
|
int(SpvImageOperandsMakeTexelVisibleKHRMask) |
|
|
|
|
int(SpvImageOperandsNonPrivateTexelKHRMask) |
|
|
|
|
int(SpvImageOperandsVolatileTexelKHRMask),
|
|
|
|
5})},
|
|
|
|
|
|
|
|
// Memory semantics ID values are numbers put into a SPIR-V
|
|
|
|
// constant integer referenced by Id. There is no token for
|
|
|
|
// them, and so no assembler or disassembler support required.
|
|
|
|
// Similar for Scope ID.
|
2019-01-29 23:56:52 +00:00
|
|
|
})));
|
2018-06-01 22:28:26 +00:00
|
|
|
|
2018-03-05 18:34:13 +00:00
|
|
|
// SPV_GOOGLE_decorate_string
|
|
|
|
|
2019-05-07 16:27:18 +00:00
|
|
|
// Now that OpDecorateString is the preferred spelling for
|
|
|
|
// OpDecorateStringGOOGLE use that name in round trip tests, and the GOOGLE
|
|
|
|
// name in an assembly-only test.
|
|
|
|
|
2019-01-29 23:56:52 +00:00
|
|
|
INSTANTIATE_TEST_SUITE_P(
|
2018-03-05 18:34:13 +00:00
|
|
|
SPV_GOOGLE_decorate_string, ExtensionRoundTripTest,
|
2019-05-07 16:27:18 +00:00
|
|
|
Combine(
|
|
|
|
// We'll get coverage over operand tables by trying the universal
|
|
|
|
// environments, and at least one specific environment.
|
|
|
|
Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1,
|
|
|
|
SPV_ENV_UNIVERSAL_1_2, SPV_ENV_VULKAN_1_0),
|
|
|
|
ValuesIn(std::vector<AssemblyCase>{
|
|
|
|
{"OpDecorateString %1 UserSemantic \"ABC\"\n",
|
|
|
|
MakeInstruction(SpvOpDecorateStringGOOGLE,
|
|
|
|
{1, SpvDecorationHlslSemanticGOOGLE},
|
|
|
|
MakeVector("ABC"))},
|
|
|
|
{"OpDecorateString %1 UserSemantic \"ABC\"\n",
|
|
|
|
MakeInstruction(SpvOpDecorateString,
|
|
|
|
{1, SpvDecorationUserSemantic},
|
|
|
|
MakeVector("ABC"))},
|
|
|
|
{"OpMemberDecorateString %1 3 UserSemantic \"DEF\"\n",
|
|
|
|
MakeInstruction(SpvOpMemberDecorateStringGOOGLE,
|
|
|
|
{1, 3, SpvDecorationUserSemantic},
|
|
|
|
MakeVector("DEF"))},
|
|
|
|
{"OpMemberDecorateString %1 3 UserSemantic \"DEF\"\n",
|
|
|
|
MakeInstruction(SpvOpMemberDecorateString,
|
|
|
|
{1, 3, SpvDecorationUserSemantic},
|
|
|
|
MakeVector("DEF"))},
|
|
|
|
})));
|
|
|
|
|
|
|
|
INSTANTIATE_TEST_SUITE_P(
|
|
|
|
SPV_GOOGLE_decorate_string, ExtensionAssemblyTest,
|
2018-03-05 18:34:13 +00:00
|
|
|
Combine(
|
|
|
|
// We'll get coverage over operand tables by trying the universal
|
|
|
|
// environments, and at least one specific environment.
|
|
|
|
Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1,
|
|
|
|
SPV_ENV_UNIVERSAL_1_2, SPV_ENV_VULKAN_1_0),
|
|
|
|
ValuesIn(std::vector<AssemblyCase>{
|
|
|
|
{"OpDecorateStringGOOGLE %1 HlslSemanticGOOGLE \"ABC\"\n",
|
|
|
|
MakeInstruction(SpvOpDecorateStringGOOGLE,
|
|
|
|
{1, SpvDecorationHlslSemanticGOOGLE},
|
|
|
|
MakeVector("ABC"))},
|
|
|
|
{"OpMemberDecorateStringGOOGLE %1 3 HlslSemanticGOOGLE \"DEF\"\n",
|
|
|
|
MakeInstruction(SpvOpMemberDecorateStringGOOGLE,
|
|
|
|
{1, 3, SpvDecorationHlslSemanticGOOGLE},
|
|
|
|
MakeVector("DEF"))},
|
2019-01-29 23:56:52 +00:00
|
|
|
})));
|
2018-03-05 18:34:13 +00:00
|
|
|
|
|
|
|
// SPV_GOOGLE_hlsl_functionality1
|
|
|
|
|
2019-05-07 16:27:18 +00:00
|
|
|
// Now that CounterBuffer is the preferred spelling for HlslCounterBufferGOOGLE,
|
|
|
|
// use that name in round trip tests, and the GOOGLE name in an assembly-only
|
|
|
|
// test.
|
2019-01-29 23:56:52 +00:00
|
|
|
INSTANTIATE_TEST_SUITE_P(
|
2018-03-05 18:34:13 +00:00
|
|
|
SPV_GOOGLE_hlsl_functionality1, ExtensionRoundTripTest,
|
|
|
|
Combine(
|
|
|
|
// We'll get coverage over operand tables by trying the universal
|
2019-05-07 16:27:18 +00:00
|
|
|
// environments, and at least one specific environment.
|
|
|
|
Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1,
|
|
|
|
SPV_ENV_UNIVERSAL_1_2, SPV_ENV_VULKAN_1_0),
|
|
|
|
// HlslSemanticGOOGLE is tested in SPV_GOOGLE_decorate_string, since
|
|
|
|
// they are coupled together.
|
|
|
|
ValuesIn(std::vector<AssemblyCase>{
|
|
|
|
{"OpDecorateId %1 CounterBuffer %2\n",
|
|
|
|
MakeInstruction(SpvOpDecorateId,
|
|
|
|
{1, SpvDecorationHlslCounterBufferGOOGLE, 2})},
|
|
|
|
{"OpDecorateId %1 CounterBuffer %2\n",
|
|
|
|
MakeInstruction(SpvOpDecorateId,
|
|
|
|
{1, SpvDecorationCounterBuffer, 2})},
|
|
|
|
})));
|
|
|
|
|
|
|
|
INSTANTIATE_TEST_SUITE_P(
|
|
|
|
SPV_GOOGLE_hlsl_functionality1, ExtensionAssemblyTest,
|
|
|
|
Combine(
|
|
|
|
// We'll get coverage over operand tables by trying the universal
|
2018-03-05 18:34:13 +00:00
|
|
|
// environments, and at least one specific environment.
|
|
|
|
Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1,
|
|
|
|
SPV_ENV_UNIVERSAL_1_2, SPV_ENV_VULKAN_1_0),
|
|
|
|
// HlslSemanticGOOGLE is tested in SPV_GOOGLE_decorate_string, since
|
|
|
|
// they are coupled together.
|
|
|
|
ValuesIn(std::vector<AssemblyCase>{
|
|
|
|
{"OpDecorateId %1 HlslCounterBufferGOOGLE %2\n",
|
|
|
|
MakeInstruction(SpvOpDecorateId,
|
|
|
|
{1, SpvDecorationHlslCounterBufferGOOGLE, 2})},
|
2019-01-29 23:56:52 +00:00
|
|
|
})));
|
2018-06-06 06:07:51 +00:00
|
|
|
|
|
|
|
// SPV_NV_viewport_array2
|
|
|
|
|
2019-01-29 23:56:52 +00:00
|
|
|
INSTANTIATE_TEST_SUITE_P(
|
2018-06-06 06:07:51 +00:00
|
|
|
SPV_NV_viewport_array2, ExtensionRoundTripTest,
|
|
|
|
Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1,
|
|
|
|
SPV_ENV_UNIVERSAL_1_2, SPV_ENV_UNIVERSAL_1_3,
|
|
|
|
SPV_ENV_VULKAN_1_0, SPV_ENV_VULKAN_1_1),
|
|
|
|
ValuesIn(std::vector<AssemblyCase>{
|
|
|
|
{"OpExtension \"SPV_NV_viewport_array2\"\n",
|
|
|
|
MakeInstruction(SpvOpExtension,
|
|
|
|
MakeVector("SPV_NV_viewport_array2"))},
|
|
|
|
// The EXT and NV extensions have the same token number for this
|
|
|
|
// capability.
|
|
|
|
{"OpCapability ShaderViewportIndexLayerEXT\n",
|
|
|
|
MakeInstruction(SpvOpCapability,
|
|
|
|
{SpvCapabilityShaderViewportIndexLayerNV})},
|
|
|
|
// Check the new capability's token number
|
|
|
|
{"OpCapability ShaderViewportIndexLayerEXT\n",
|
|
|
|
MakeInstruction(SpvOpCapability, {5254})},
|
|
|
|
// Decorations
|
|
|
|
{"OpDecorate %1 ViewportRelativeNV\n",
|
|
|
|
MakeInstruction(SpvOpDecorate,
|
|
|
|
{1, SpvDecorationViewportRelativeNV})},
|
|
|
|
{"OpDecorate %1 BuiltIn ViewportMaskNV\n",
|
|
|
|
MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn,
|
|
|
|
SpvBuiltInViewportMaskNV})},
|
2019-01-29 23:56:52 +00:00
|
|
|
})));
|
2018-03-05 18:34:13 +00:00
|
|
|
|
2018-04-05 19:09:38 +00:00
|
|
|
// SPV_NV_shader_subgroup_partitioned
|
|
|
|
|
2019-01-29 23:56:52 +00:00
|
|
|
INSTANTIATE_TEST_SUITE_P(
|
2018-04-05 19:09:38 +00:00
|
|
|
SPV_NV_shader_subgroup_partitioned, ExtensionRoundTripTest,
|
|
|
|
Combine(
|
|
|
|
Values(SPV_ENV_UNIVERSAL_1_3, SPV_ENV_VULKAN_1_1),
|
|
|
|
ValuesIn(std::vector<AssemblyCase>{
|
|
|
|
{"OpExtension \"SPV_NV_shader_subgroup_partitioned\"\n",
|
|
|
|
MakeInstruction(SpvOpExtension,
|
|
|
|
MakeVector("SPV_NV_shader_subgroup_partitioned"))},
|
|
|
|
{"OpCapability GroupNonUniformPartitionedNV\n",
|
|
|
|
MakeInstruction(SpvOpCapability,
|
|
|
|
{SpvCapabilityGroupNonUniformPartitionedNV})},
|
|
|
|
// Check the new capability's token number
|
|
|
|
{"OpCapability GroupNonUniformPartitionedNV\n",
|
|
|
|
MakeInstruction(SpvOpCapability, {5297})},
|
|
|
|
{"%2 = OpGroupNonUniformPartitionNV %1 %3\n",
|
|
|
|
MakeInstruction(SpvOpGroupNonUniformPartitionNV, {1, 2, 3})},
|
|
|
|
// Check the new instruction's token number
|
|
|
|
{"%2 = OpGroupNonUniformPartitionNV %1 %3\n",
|
|
|
|
MakeInstruction(static_cast<SpvOp>(5296), {1, 2, 3})},
|
|
|
|
// Check the new group operations
|
|
|
|
{"%2 = OpGroupIAdd %1 %3 PartitionedReduceNV %4\n",
|
|
|
|
MakeInstruction(SpvOpGroupIAdd,
|
|
|
|
{1, 2, 3, SpvGroupOperationPartitionedReduceNV,
|
|
|
|
4})},
|
|
|
|
{"%2 = OpGroupIAdd %1 %3 PartitionedReduceNV %4\n",
|
|
|
|
MakeInstruction(SpvOpGroupIAdd, {1, 2, 3, 6, 4})},
|
|
|
|
{"%2 = OpGroupIAdd %1 %3 PartitionedInclusiveScanNV %4\n",
|
|
|
|
MakeInstruction(SpvOpGroupIAdd,
|
|
|
|
{1, 2, 3,
|
|
|
|
SpvGroupOperationPartitionedInclusiveScanNV, 4})},
|
|
|
|
{"%2 = OpGroupIAdd %1 %3 PartitionedInclusiveScanNV %4\n",
|
|
|
|
MakeInstruction(SpvOpGroupIAdd, {1, 2, 3, 7, 4})},
|
|
|
|
{"%2 = OpGroupIAdd %1 %3 PartitionedExclusiveScanNV %4\n",
|
|
|
|
MakeInstruction(SpvOpGroupIAdd,
|
|
|
|
{1, 2, 3,
|
|
|
|
SpvGroupOperationPartitionedExclusiveScanNV, 4})},
|
|
|
|
{"%2 = OpGroupIAdd %1 %3 PartitionedExclusiveScanNV %4\n",
|
|
|
|
MakeInstruction(SpvOpGroupIAdd, {1, 2, 3, 8, 4})},
|
2019-01-29 23:56:52 +00:00
|
|
|
})));
|
2018-04-05 19:09:38 +00:00
|
|
|
|
2018-04-05 21:10:57 +00:00
|
|
|
// SPV_EXT_descriptor_indexing
|
|
|
|
|
2019-01-29 23:56:52 +00:00
|
|
|
INSTANTIATE_TEST_SUITE_P(
|
2018-04-05 21:10:57 +00:00
|
|
|
SPV_EXT_descriptor_indexing, ExtensionRoundTripTest,
|
|
|
|
Combine(
|
|
|
|
Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1,
|
|
|
|
SPV_ENV_UNIVERSAL_1_2, SPV_ENV_UNIVERSAL_1_3, SPV_ENV_VULKAN_1_0,
|
|
|
|
SPV_ENV_VULKAN_1_1),
|
|
|
|
ValuesIn(std::vector<AssemblyCase>{
|
|
|
|
{"OpExtension \"SPV_EXT_descriptor_indexing\"\n",
|
|
|
|
MakeInstruction(SpvOpExtension,
|
|
|
|
MakeVector("SPV_EXT_descriptor_indexing"))},
|
|
|
|
// Check capabilities, by name
|
|
|
|
{"OpCapability ShaderNonUniformEXT\n",
|
|
|
|
MakeInstruction(SpvOpCapability,
|
|
|
|
{SpvCapabilityShaderNonUniformEXT})},
|
|
|
|
{"OpCapability RuntimeDescriptorArrayEXT\n",
|
|
|
|
MakeInstruction(SpvOpCapability,
|
|
|
|
{SpvCapabilityRuntimeDescriptorArrayEXT})},
|
|
|
|
{"OpCapability InputAttachmentArrayDynamicIndexingEXT\n",
|
|
|
|
MakeInstruction(
|
|
|
|
SpvOpCapability,
|
|
|
|
{SpvCapabilityInputAttachmentArrayDynamicIndexingEXT})},
|
|
|
|
{"OpCapability UniformTexelBufferArrayDynamicIndexingEXT\n",
|
|
|
|
MakeInstruction(
|
|
|
|
SpvOpCapability,
|
|
|
|
{SpvCapabilityUniformTexelBufferArrayDynamicIndexingEXT})},
|
|
|
|
{"OpCapability StorageTexelBufferArrayDynamicIndexingEXT\n",
|
|
|
|
MakeInstruction(
|
|
|
|
SpvOpCapability,
|
|
|
|
{SpvCapabilityStorageTexelBufferArrayDynamicIndexingEXT})},
|
|
|
|
{"OpCapability UniformBufferArrayNonUniformIndexingEXT\n",
|
|
|
|
MakeInstruction(
|
|
|
|
SpvOpCapability,
|
|
|
|
{SpvCapabilityUniformBufferArrayNonUniformIndexingEXT})},
|
|
|
|
{"OpCapability SampledImageArrayNonUniformIndexingEXT\n",
|
|
|
|
MakeInstruction(
|
|
|
|
SpvOpCapability,
|
|
|
|
{SpvCapabilitySampledImageArrayNonUniformIndexingEXT})},
|
|
|
|
{"OpCapability StorageBufferArrayNonUniformIndexingEXT\n",
|
|
|
|
MakeInstruction(
|
|
|
|
SpvOpCapability,
|
|
|
|
{SpvCapabilityStorageBufferArrayNonUniformIndexingEXT})},
|
|
|
|
{"OpCapability StorageImageArrayNonUniformIndexingEXT\n",
|
|
|
|
MakeInstruction(
|
|
|
|
SpvOpCapability,
|
|
|
|
{SpvCapabilityStorageImageArrayNonUniformIndexingEXT})},
|
|
|
|
{"OpCapability InputAttachmentArrayNonUniformIndexingEXT\n",
|
|
|
|
MakeInstruction(
|
|
|
|
SpvOpCapability,
|
|
|
|
{SpvCapabilityInputAttachmentArrayNonUniformIndexingEXT})},
|
|
|
|
{"OpCapability UniformTexelBufferArrayNonUniformIndexingEXT\n",
|
|
|
|
MakeInstruction(
|
|
|
|
SpvOpCapability,
|
|
|
|
{SpvCapabilityUniformTexelBufferArrayNonUniformIndexingEXT})},
|
|
|
|
{"OpCapability StorageTexelBufferArrayNonUniformIndexingEXT\n",
|
|
|
|
MakeInstruction(
|
|
|
|
SpvOpCapability,
|
|
|
|
{SpvCapabilityStorageTexelBufferArrayNonUniformIndexingEXT})},
|
|
|
|
// Check capabilities, by number
|
|
|
|
{"OpCapability ShaderNonUniformEXT\n",
|
|
|
|
MakeInstruction(SpvOpCapability, {5301})},
|
|
|
|
{"OpCapability RuntimeDescriptorArrayEXT\n",
|
|
|
|
MakeInstruction(SpvOpCapability, {5302})},
|
|
|
|
{"OpCapability InputAttachmentArrayDynamicIndexingEXT\n",
|
|
|
|
MakeInstruction(SpvOpCapability, {5303})},
|
|
|
|
{"OpCapability UniformTexelBufferArrayDynamicIndexingEXT\n",
|
|
|
|
MakeInstruction(SpvOpCapability, {5304})},
|
|
|
|
{"OpCapability StorageTexelBufferArrayDynamicIndexingEXT\n",
|
|
|
|
MakeInstruction(SpvOpCapability, {5305})},
|
|
|
|
{"OpCapability UniformBufferArrayNonUniformIndexingEXT\n",
|
|
|
|
MakeInstruction(SpvOpCapability, {5306})},
|
|
|
|
{"OpCapability SampledImageArrayNonUniformIndexingEXT\n",
|
|
|
|
MakeInstruction(SpvOpCapability, {5307})},
|
|
|
|
{"OpCapability StorageBufferArrayNonUniformIndexingEXT\n",
|
|
|
|
MakeInstruction(SpvOpCapability, {5308})},
|
|
|
|
{"OpCapability StorageImageArrayNonUniformIndexingEXT\n",
|
|
|
|
MakeInstruction(SpvOpCapability, {5309})},
|
|
|
|
{"OpCapability InputAttachmentArrayNonUniformIndexingEXT\n",
|
|
|
|
MakeInstruction(SpvOpCapability, {5310})},
|
|
|
|
{"OpCapability UniformTexelBufferArrayNonUniformIndexingEXT\n",
|
|
|
|
MakeInstruction(SpvOpCapability, {5311})},
|
|
|
|
{"OpCapability StorageTexelBufferArrayNonUniformIndexingEXT\n",
|
|
|
|
MakeInstruction(SpvOpCapability, {5312})},
|
|
|
|
|
|
|
|
// Check the decoration token
|
|
|
|
{"OpDecorate %1 NonUniformEXT\n",
|
|
|
|
MakeInstruction(SpvOpDecorate, {1, SpvDecorationNonUniformEXT})},
|
|
|
|
{"OpDecorate %1 NonUniformEXT\n",
|
|
|
|
MakeInstruction(SpvOpDecorate, {1, 5300})},
|
2019-01-29 23:56:52 +00:00
|
|
|
})));
|
2018-04-05 21:10:57 +00:00
|
|
|
|
2018-07-11 13:24:49 +00:00
|
|
|
} // namespace
|
|
|
|
} // namespace spvtools
|