From 926ce6a7b47df708d1490f65e515988f1f935bd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=80=D0=B0=D0=BD=D0=B8=D0=BC=D0=B8=D1=80=20=D0=9A?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D1=9F=D0=B8=D1=9B?= Date: Fri, 1 Feb 2019 21:09:44 -0800 Subject: [PATCH] Updated spirv-tools. --- 3rdparty/spirv-tools/BUILD.gn | 2 + .../include/generated/build-version.inc | 2 +- .../source/opt/block_merge_util.cpp | 16 + 3rdparty/spirv-tools/source/opt/optimizer.cpp | 3 +- .../spirv-tools/source/reduce/CMakeLists.txt | 4 + .../merge_blocks_reduction_opportunity.cpp | 67 + .../merge_blocks_reduction_opportunity.h | 53 + ...ge_blocks_reduction_opportunity_finder.cpp | 48 + ...erge_blocks_reduction_opportunity_finder.h | 42 + .../source/val/validate_annotation.cpp | 181 ++- .../source/val/validate_builtins.cpp | 218 ++- .../source/val/validate_decorations.cpp | 54 + .../spirv-tools/source/val/validate_type.cpp | 10 + .../spirv-tools/source/val/validation_state.h | 74 + .../test/assembly_context_test.cpp | 4 +- .../spirv-tools/test/binary_parse_test.cpp | 12 +- .../test/binary_to_text.literal_test.cpp | 8 +- .../spirv-tools/test/binary_to_text_test.cpp | 90 +- .../test/comp/markv_codec_test.cpp | 12 +- 3rdparty/spirv-tools/test/enum_set_test.cpp | 36 +- .../test/enum_string_mapping_test.cpp | 16 +- .../test/ext_inst.debuginfo_test.cpp | 406 ++--- .../spirv-tools/test/ext_inst.glsl_test.cpp | 4 +- .../spirv-tools/test/ext_inst.opencl_test.cpp | 36 +- .../test/generator_magic_number_test.cpp | 8 +- 3rdparty/spirv-tools/test/hex_float_test.cpp | 80 +- .../spirv-tools/test/name_mapper_test.cpp | 156 +- 3rdparty/spirv-tools/test/named_id_test.cpp | 4 +- .../test/opcode_require_capabilities_test.cpp | 4 +- .../test/opcode_table_get_test.cpp | 4 +- .../test/operand_capabilities_test.cpp | 132 +- .../spirv-tools/test/operand_pattern_test.cpp | 16 +- 3rdparty/spirv-tools/test/operand_test.cpp | 8 +- .../opt/aggressive_dead_code_elim_test.cpp | 14 +- .../spirv-tools/test/opt/block_merge_test.cpp | 139 ++ .../spirv-tools/test/opt/def_use_test.cpp | 12 +- .../test/opt/eliminate_dead_const_test.cpp | 14 +- .../test/opt/flatten_decoration_test.cpp | 292 ++-- .../opt/fold_spec_const_op_composite_test.cpp | 16 +- 3rdparty/spirv-tools/test/opt/fold_test.cpp | 84 +- .../test/opt/freeze_spec_const_test.cpp | 2 +- .../opt/set_spec_const_default_value_test.cpp | 12 +- .../test/opt/strip_debug_info_test.cpp | 2 +- .../spirv-tools/test/opt/unify_const_test.cpp | 10 +- 3rdparty/spirv-tools/test/opt/utils_test.cpp | 2 +- .../spirv-tools/test/reduce/CMakeLists.txt | 3 +- .../test/reduce/merge_blocks_test.cpp | 513 +++++++ 3rdparty/spirv-tools/test/target_env_test.cpp | 6 +- .../spirv-tools/test/text_literal_test.cpp | 16 +- .../test/text_to_binary.annotation_test.cpp | 40 +- .../test/text_to_binary.constant_test.cpp | 60 +- .../test/text_to_binary.control_flow_test.cpp | 32 +- .../test/text_to_binary.debug_test.cpp | 36 +- ...ext_to_binary.device_side_enqueue_test.cpp | 4 +- .../test/text_to_binary.extension_test.cpp | 84 +- .../test/text_to_binary.function_test.cpp | 4 +- .../test/text_to_binary.group_test.cpp | 4 +- .../test/text_to_binary.image_test.cpp | 42 +- .../test/text_to_binary.memory_test.cpp | 8 +- .../test/text_to_binary.mode_setting_test.cpp | 20 +- .../text_to_binary.type_declaration_test.cpp | 16 +- .../spirv-tools/test/text_to_binary_test.cpp | 24 +- 3rdparty/spirv-tools/test/val/CMakeLists.txt | 3 + .../test/val/val_builtins_test.cpp | 1330 ++++++++++------- .../test/val/val_capability_test.cpp | 75 +- .../spirv-tools/test/val/val_cfg_test.cpp | 6 +- .../test/val/val_code_generator.cpp | 222 +++ .../spirv-tools/test/val/val_code_generator.h | 49 + .../test/val/val_constants_test.cpp | 10 +- .../test/val/val_decoration_test.cpp | 332 +++- .../test/val/val_ext_inst_test.cpp | 424 +++--- .../test/val/val_extensions_test.cpp | 18 +- 3rdparty/spirv-tools/test/val/val_id_test.cpp | 6 +- .../spirv-tools/test/val/val_layout_test.cpp | 6 +- .../test/val/val_literals_test.cpp | 4 +- .../spirv-tools/test/val/val_memory_test.cpp | 2 +- .../spirv-tools/test/val/val_modes_test.cpp | 52 +- .../test/val/val_non_uniform_test.cpp | 142 +- .../spirv-tools/test/val/val_ssa_test.cpp | 2 +- .../spirv-tools/test/val/val_storage_test.cpp | 4 +- .../spirv-tools/test/val/val_version_test.cpp | 8 +- 3rdparty/spirv-tools/tools/reduce/reduce.cpp | 3 + 82 files changed, 4084 insertions(+), 1935 deletions(-) create mode 100644 3rdparty/spirv-tools/source/reduce/merge_blocks_reduction_opportunity.cpp create mode 100644 3rdparty/spirv-tools/source/reduce/merge_blocks_reduction_opportunity.h create mode 100644 3rdparty/spirv-tools/source/reduce/merge_blocks_reduction_opportunity_finder.cpp create mode 100644 3rdparty/spirv-tools/source/reduce/merge_blocks_reduction_opportunity_finder.h create mode 100644 3rdparty/spirv-tools/test/reduce/merge_blocks_test.cpp create mode 100644 3rdparty/spirv-tools/test/val/val_code_generator.cpp create mode 100644 3rdparty/spirv-tools/test/val/val_code_generator.h diff --git a/3rdparty/spirv-tools/BUILD.gn b/3rdparty/spirv-tools/BUILD.gn index 69e3dc812..01044bf7a 100644 --- a/3rdparty/spirv-tools/BUILD.gn +++ b/3rdparty/spirv-tools/BUILD.gn @@ -452,6 +452,8 @@ static_library("spvtools_opt") { "source/opt/basic_block.h", "source/opt/block_merge_pass.cpp", "source/opt/block_merge_pass.h", + "source/opt/block_merge_util.cpp", + "source/opt/block_merge_util.h", "source/opt/build_module.cpp", "source/opt/build_module.h", "source/opt/ccp_pass.cpp", diff --git a/3rdparty/spirv-tools/include/generated/build-version.inc b/3rdparty/spirv-tools/include/generated/build-version.inc index 3f41d9185..b5470c994 100644 --- a/3rdparty/spirv-tools/include/generated/build-version.inc +++ b/3rdparty/spirv-tools/include/generated/build-version.inc @@ -1 +1 @@ -"v2019.2-dev", "SPIRV-Tools v2019.2-dev 3aeb8ce06558847fce74ef8e4a12862a3d29db89" +"v2019.2-dev", "SPIRV-Tools v2019.2-dev 6bc0c3fb0a18b013fc222ac6173abaff22f65a39" diff --git a/3rdparty/spirv-tools/source/opt/block_merge_util.cpp b/3rdparty/spirv-tools/source/opt/block_merge_util.cpp index 0a46ae6ed..5d6048aef 100644 --- a/3rdparty/spirv-tools/source/opt/block_merge_util.cpp +++ b/3rdparty/spirv-tools/source/opt/block_merge_util.cpp @@ -49,6 +49,20 @@ bool IsMerge(IRContext* context, BasicBlock* block) { return IsMerge(context, block->id()); } +// Removes any OpPhi instructions in |block|, which should have exactly one +// predecessor, replacing uses of OpPhi ids with the ids associated with the +// predecessor. +void EliminateOpPhiInstructions(IRContext* context, BasicBlock* block) { + block->ForEachPhiInst([context](Instruction* phi) { + assert(2 == phi->NumInOperands() && + "A block can only have one predecessor for block merging to make " + "sense."); + context->ReplaceAllUsesWith(phi->result_id(), + phi->GetSingleWordInOperand(0)); + context->KillInst(phi); + }); +} + } // Anonymous namespace bool CanMergeWithSuccessor(IRContext* context, BasicBlock* block) { @@ -124,6 +138,8 @@ void MergeWithSuccessor(IRContext* context, Function* func, context->set_instr_block(&inst, &*bi); } + EliminateOpPhiInstructions(context, &*sbi); + // Now actually move the instructions. bi->AddInstructions(&*sbi); diff --git a/3rdparty/spirv-tools/source/opt/optimizer.cpp b/3rdparty/spirv-tools/source/opt/optimizer.cpp index 30e80d718..4eb0c4006 100644 --- a/3rdparty/spirv-tools/source/opt/optimizer.cpp +++ b/3rdparty/spirv-tools/source/opt/optimizer.cpp @@ -182,8 +182,7 @@ Optimizer& Optimizer::RegisterPerformancePasses() { .RegisterPass(CreateRedundancyEliminationPass()) .RegisterPass(CreateDeadBranchElimPass()) .RegisterPass(CreateBlockMergePass()) - .RegisterPass(CreateSimplificationPass()) - .RegisterPass(CreateCodeSinkingPass()); + .RegisterPass(CreateSimplificationPass()); // Currently exposing driver bugs resulting in crashes (#946) // .RegisterPass(CreateCommonUniformElimPass()) } diff --git a/3rdparty/spirv-tools/source/reduce/CMakeLists.txt b/3rdparty/spirv-tools/source/reduce/CMakeLists.txt index 2f8c460df..309e89b8a 100644 --- a/3rdparty/spirv-tools/source/reduce/CMakeLists.txt +++ b/3rdparty/spirv-tools/source/reduce/CMakeLists.txt @@ -14,6 +14,8 @@ set(SPIRV_TOOLS_REDUCE_SOURCES change_operand_reduction_opportunity.h change_operand_to_undef_reduction_opportunity.h + merge_blocks_reduction_opportunity.h + merge_blocks_reduction_opportunity_finder.h operand_to_const_reduction_opportunity_finder.h operand_to_undef_reduction_opportunity_finder.h operand_to_dominating_id_reduction_opportunity_finder.h @@ -30,6 +32,8 @@ set(SPIRV_TOOLS_REDUCE_SOURCES change_operand_reduction_opportunity.cpp change_operand_to_undef_reduction_opportunity.cpp + merge_blocks_reduction_opportunity.cpp + merge_blocks_reduction_opportunity_finder.cpp operand_to_const_reduction_opportunity_finder.cpp operand_to_undef_reduction_opportunity_finder.cpp operand_to_dominating_id_reduction_opportunity_finder.cpp diff --git a/3rdparty/spirv-tools/source/reduce/merge_blocks_reduction_opportunity.cpp b/3rdparty/spirv-tools/source/reduce/merge_blocks_reduction_opportunity.cpp new file mode 100644 index 000000000..8ee4562a7 --- /dev/null +++ b/3rdparty/spirv-tools/source/reduce/merge_blocks_reduction_opportunity.cpp @@ -0,0 +1,67 @@ +// Copyright (c) 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. + +#include "merge_blocks_reduction_opportunity.h" +#include "source/opt/block_merge_util.h" + +#include "source/opt/ir_context.h" + +namespace spvtools { +namespace reduce { + +using namespace opt; + +MergeBlocksReductionOpportunity::MergeBlocksReductionOpportunity( + IRContext* context, Function* function, BasicBlock* block) { + // Precondition: the terminator has to be OpBranch. + assert(block->terminator()->opcode() == SpvOpBranch); + context_ = context; + function_ = function; + // Get the successor block associated with the OpBranch. + successor_block_ = + context->cfg()->block(block->terminator()->GetSingleWordInOperand(0)); +} + +bool MergeBlocksReductionOpportunity::PreconditionHolds() { + // By construction, it is not possible for the merging of A->B to disable the + // merging of C->D, even when B and C are the same block. + return true; +} + +void MergeBlocksReductionOpportunity::Apply() { + // While the original block that targeted the successor may not exist anymore + // (it might have been merged with another block), some block must exist that + // targets the successor. Find it. + + const auto predecessors = context_->cfg()->preds(successor_block_->id()); + assert(1 == predecessors.size() && + "For a successor to be merged into its predecessor, exactly one " + "predecessor must be present."); + const uint32_t predecessor_id = predecessors[0]; + + for (auto bi = function_->begin(); bi != function_->end(); ++bi) { + if (bi->id() == predecessor_id) { + blockmergeutil::MergeWithSuccessor(context_, function_, bi); + // Block merging changes the control flow graph, so invalidate it. + context_->InvalidateAnalysesExceptFor(IRContext::Analysis::kAnalysisNone); + return; + } + } + + assert(false && + "Unreachable: we should have found a block with the desired id."); +} + +} // namespace reduce +} // namespace spvtools diff --git a/3rdparty/spirv-tools/source/reduce/merge_blocks_reduction_opportunity.h b/3rdparty/spirv-tools/source/reduce/merge_blocks_reduction_opportunity.h new file mode 100644 index 000000000..aa78f8578 --- /dev/null +++ b/3rdparty/spirv-tools/source/reduce/merge_blocks_reduction_opportunity.h @@ -0,0 +1,53 @@ +// Copyright (c) 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. + +#ifndef SOURCE_REDUCE_MERGE_BLOCKS_REDUCTION_OPPORTUNITY_H_ +#define SOURCE_REDUCE_MERGE_BLOCKS_REDUCTION_OPPORTUNITY_H_ + +#include "reduction_opportunity.h" +#include "source/opt/basic_block.h" +#include "source/opt/function.h" + +namespace spvtools { +namespace reduce { + +// An opportunity to merge two blocks into one. +class MergeBlocksReductionOpportunity : public ReductionOpportunity { + public: + // Creates the opportunity to merge |block| with its successor, where |block| + // is inside |function|, and |context| is the enclosing IR context. + MergeBlocksReductionOpportunity(opt::IRContext* context, + opt::Function* function, + opt::BasicBlock* block); + + bool PreconditionHolds() override; + + protected: + void Apply() override; + + private: + opt::IRContext* context_; + opt::Function* function_; + + // Rather than holding on to the block that can be merged with its successor, + // we hold on to its successor. This is because the predecessor block might + // get merged with *its* predecessor, and so will no longer exist, while the + // successor will continue to exist until this opportunity gets applied. + opt::BasicBlock* successor_block_; +}; + +} // namespace reduce +} // namespace spvtools + +#endif // SOURCE_REDUCE_MERGE_BLOCKS_REDUCTION_OPPORTUNITY_H_ diff --git a/3rdparty/spirv-tools/source/reduce/merge_blocks_reduction_opportunity_finder.cpp b/3rdparty/spirv-tools/source/reduce/merge_blocks_reduction_opportunity_finder.cpp new file mode 100644 index 000000000..0546e1ffc --- /dev/null +++ b/3rdparty/spirv-tools/source/reduce/merge_blocks_reduction_opportunity_finder.cpp @@ -0,0 +1,48 @@ +// Copyright (c) 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. + +#include "source/reduce/merge_blocks_reduction_opportunity_finder.h" +#include "source/opt/block_merge_util.h" +#include "source/reduce/merge_blocks_reduction_opportunity.h" + +namespace spvtools { +namespace reduce { + +using namespace opt; + +std::string MergeBlocksReductionOpportunityFinder::GetName() const { + return "MergeBlocksReductionOpportunityFinder"; +} + +std::vector> +MergeBlocksReductionOpportunityFinder::GetAvailableOpportunities( + opt::IRContext* context) const { + std::vector> result; + + // Consider every block in every function. + for (auto& function : *context->module()) { + for (auto& block : function) { + // See whether it is possible to merge this block with its successor. + if (blockmergeutil::CanMergeWithSuccessor(context, &block)) { + // It is, so record an opportunity to do this. + result.push_back(spvtools::MakeUnique( + context, &function, &block)); + } + } + } + return result; +} + +} // namespace reduce +} // namespace spvtools diff --git a/3rdparty/spirv-tools/source/reduce/merge_blocks_reduction_opportunity_finder.h b/3rdparty/spirv-tools/source/reduce/merge_blocks_reduction_opportunity_finder.h new file mode 100644 index 000000000..dbf82fec8 --- /dev/null +++ b/3rdparty/spirv-tools/source/reduce/merge_blocks_reduction_opportunity_finder.h @@ -0,0 +1,42 @@ +// Copyright (c) 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. + +#ifndef SOURCE_REDUCE_MERGE_BLOCKS_REDUCTION_OPPORTUNITY_FINDER_H_ +#define SOURCE_REDUCE_MERGE_BLOCKS_REDUCTION_OPPORTUNITY_FINDER_H_ + +#include "source/reduce/reduction_opportunity_finder.h" + +namespace spvtools { +namespace reduce { + +// A finder of opportunities to merge blocks together. +class MergeBlocksReductionOpportunityFinder + : public ReductionOpportunityFinder { + public: + MergeBlocksReductionOpportunityFinder() = default; + + ~MergeBlocksReductionOpportunityFinder() override = default; + + std::string GetName() const final; + + std::vector> GetAvailableOpportunities( + opt::IRContext* context) const final; + + private: +}; + +} // namespace reduce +} // namespace spvtools + +#endif // SOURCE_REDUCE_MERGE_BLOCKS_REDUCTION_OPPORTUNITY_FINDER_H_ diff --git a/3rdparty/spirv-tools/source/val/validate_annotation.cpp b/3rdparty/spirv-tools/source/val/validate_annotation.cpp index 621ace2a6..5963b243a 100644 --- a/3rdparty/spirv-tools/source/val/validate_annotation.cpp +++ b/3rdparty/spirv-tools/source/val/validate_annotation.cpp @@ -23,6 +23,168 @@ namespace spvtools { namespace val { namespace { +bool IsValidWebGPUDecoration(uint32_t decoration) { + switch (decoration) { + case SpvDecorationSpecId: + case SpvDecorationBlock: + case SpvDecorationRowMajor: + case SpvDecorationColMajor: + case SpvDecorationArrayStride: + case SpvDecorationMatrixStride: + case SpvDecorationBuiltIn: + case SpvDecorationNoPerspective: + case SpvDecorationFlat: + case SpvDecorationCentroid: + case SpvDecorationRestrict: + case SpvDecorationAliased: + case SpvDecorationNonWritable: + case SpvDecorationNonReadable: + case SpvDecorationUniform: + case SpvDecorationLocation: + case SpvDecorationComponent: + case SpvDecorationIndex: + case SpvDecorationBinding: + case SpvDecorationDescriptorSet: + case SpvDecorationOffset: + case SpvDecorationNoContraction: + return true; + default: + return false; + } +} + +std::string LogStringForDecoration(uint32_t decoration) { + switch (decoration) { + case SpvDecorationRelaxedPrecision: + return "RelaxedPrecision"; + case SpvDecorationSpecId: + return "SpecId"; + case SpvDecorationBlock: + return "Block"; + case SpvDecorationBufferBlock: + return "BufferBlock"; + case SpvDecorationRowMajor: + return "RowMajor"; + case SpvDecorationColMajor: + return "ColMajor"; + case SpvDecorationArrayStride: + return "ArrayStride"; + case SpvDecorationMatrixStride: + return "MatrixStride"; + case SpvDecorationGLSLShared: + return "GLSLShared"; + case SpvDecorationGLSLPacked: + return "GLSLPacked"; + case SpvDecorationCPacked: + return "CPacked"; + case SpvDecorationBuiltIn: + return "BuiltIn"; + case SpvDecorationNoPerspective: + return "NoPerspective"; + case SpvDecorationFlat: + return "Flat"; + case SpvDecorationPatch: + return "Patch"; + case SpvDecorationCentroid: + return "Centroid"; + case SpvDecorationSample: + return "Sample"; + case SpvDecorationInvariant: + return "Invariant"; + case SpvDecorationRestrict: + return "Restrict"; + case SpvDecorationAliased: + return "Aliased"; + case SpvDecorationVolatile: + return "Volatile"; + case SpvDecorationConstant: + return "Constant"; + case SpvDecorationCoherent: + return "Coherent"; + case SpvDecorationNonWritable: + return "NonWritable"; + case SpvDecorationNonReadable: + return "NonReadable"; + case SpvDecorationUniform: + return "Uniform"; + case SpvDecorationSaturatedConversion: + return "SaturatedConversion"; + case SpvDecorationStream: + return "Stream"; + case SpvDecorationLocation: + return "Location"; + case SpvDecorationComponent: + return "Component"; + case SpvDecorationIndex: + return "Index"; + case SpvDecorationBinding: + return "Binding"; + case SpvDecorationDescriptorSet: + return "DescriptorSet"; + case SpvDecorationOffset: + return "Offset"; + case SpvDecorationXfbBuffer: + return "XfbBuffer"; + case SpvDecorationXfbStride: + return "XfbStride"; + case SpvDecorationFuncParamAttr: + return "FuncParamAttr"; + case SpvDecorationFPRoundingMode: + return "FPRoundingMode"; + case SpvDecorationFPFastMathMode: + return "FPFastMathMode"; + case SpvDecorationLinkageAttributes: + return "LinkageAttributes"; + case SpvDecorationNoContraction: + return "NoContraction"; + case SpvDecorationInputAttachmentIndex: + return "InputAttachmentIndex"; + case SpvDecorationAlignment: + return "Alignment"; + case SpvDecorationMaxByteOffset: + return "MaxByteOffset"; + case SpvDecorationAlignmentId: + return "AlignmentId"; + case SpvDecorationMaxByteOffsetId: + return "MaxByteOffsetId"; + case SpvDecorationNoSignedWrap: + return "NoSignedWrap"; + case SpvDecorationNoUnsignedWrap: + return "NoUnsignedWrap"; + case SpvDecorationExplicitInterpAMD: + return "ExplicitInterpAMD"; + case SpvDecorationOverrideCoverageNV: + return "OverrideCoverageNV"; + case SpvDecorationPassthroughNV: + return "PassthroughNV"; + case SpvDecorationViewportRelativeNV: + return "ViewportRelativeNV"; + case SpvDecorationSecondaryViewportRelativeNV: + return "SecondaryViewportRelativeNV"; + case SpvDecorationPerPrimitiveNV: + return "PerPrimitiveNV"; + case SpvDecorationPerViewNV: + return "PerViewNV"; + case SpvDecorationPerTaskNV: + return "PerTaskNV"; + case SpvDecorationPerVertexNV: + return "PerVertexNV"; + case SpvDecorationNonUniformEXT: + return "NonUniformEXT"; + case SpvDecorationRestrictPointerEXT: + return "RestrictPointerEXT"; + case SpvDecorationAliasedPointerEXT: + return "AliasedPointerEXT"; + case SpvDecorationHlslCounterBufferGOOGLE: + return "HlslCounterBufferGOOGLE"; + case SpvDecorationHlslSemanticGOOGLE: + return "HlslSemanticGOOGLE"; + default: + break; + } + return "Unknown"; +} + spv_result_t ValidateDecorate(ValidationState_t& _, const Instruction* inst) { const auto decoration = inst->GetOperandAs(1); if (decoration == SpvDecorationSpecId) { @@ -31,10 +193,18 @@ spv_result_t ValidateDecorate(ValidationState_t& _, const Instruction* inst) { if (!target || !spvOpcodeIsScalarSpecConstant(target->opcode())) { return _.diag(SPV_ERROR_INVALID_ID, inst) << "OpDecorate SpecId decoration target '" - << _.getIdName(decoration) + << _.getIdName(target_id) << "' is not a scalar specialization constant."; } } + + if (spvIsWebGPUEnv(_.context()->target_env) && + !IsValidWebGPUDecoration(decoration)) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpDecorate decoration '" << LogStringForDecoration(decoration) + << "' is not valid for the WebGPU execution environment."; + } + // TODO: Add validations for all decorations. return SPV_SUCCESS; } @@ -59,6 +229,15 @@ spv_result_t ValidateMemberDecorate(ValidationState_t& _, << " is out of bounds. The structure has " << member_count << " members. Largest valid index is " << member_count - 1 << "."; } + + const auto decoration = inst->GetOperandAs(2); + if (spvIsWebGPUEnv(_.context()->target_env) && + !IsValidWebGPUDecoration(decoration)) { + return _.diag(SPV_ERROR_INVALID_ID, inst) + << "OpMemberDecorate decoration '" << _.getIdName(decoration) + << "' is not valid for the WebGPU execution environment."; + } + return SPV_SUCCESS; } diff --git a/3rdparty/spirv-tools/source/val/validate_builtins.cpp b/3rdparty/spirv-tools/source/val/validate_builtins.cpp index ee7fc3c3d..dbe7beff5 100644 --- a/3rdparty/spirv-tools/source/val/validate_builtins.cpp +++ b/3rdparty/spirv-tools/source/val/validate_builtins.cpp @@ -101,6 +101,28 @@ SpvStorageClass GetStorageClass(const Instruction& inst) { return SpvStorageClassMax; } +bool IsBuiltInValidForWebGPU(SpvBuiltIn label) { + switch (label) { + case SpvBuiltInPosition: + case SpvBuiltInVertexIndex: + case SpvBuiltInInstanceIndex: + case SpvBuiltInFrontFacing: + case SpvBuiltInFragCoord: + case SpvBuiltInFragDepth: + case SpvBuiltInNumWorkgroups: + case SpvBuiltInWorkgroupSize: + case SpvBuiltInLocalInvocationId: + case SpvBuiltInGlobalInvocationId: + case SpvBuiltInLocalInvocationIndex: { + return true; + } + default: + break; + } + + return false; +} + // Helper class managing validation of built-ins. // TODO: Generic functionality of this class can be moved into // ValidationState_t to be made available to other users. @@ -169,6 +191,8 @@ class BuiltInsValidator { const Instruction& inst); spv_result_t ValidateVertexIdOrInstanceIdAtDefinition( const Decoration& decoration, const Instruction& inst); + spv_result_t ValidateLocalInvocationIndexAtDefinition( + const Decoration& decoration, const Instruction& inst); spv_result_t ValidateWorkgroupSizeAtDefinition(const Decoration& decoration, const Instruction& inst); // Used for GlobalInvocationId, LocalInvocationId, NumWorkgroups, WorkgroupId. @@ -267,6 +291,11 @@ class BuiltInsValidator { const Instruction& referenced_inst, const Instruction& referenced_from_inst); + spv_result_t ValidateLocalInvocationIndexAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst); + spv_result_t ValidateVertexIndexAtReference( const Decoration& decoration, const Instruction& built_in_inst, const Instruction& referenced_inst, @@ -937,12 +966,14 @@ spv_result_t BuiltInsValidator::ValidateClipOrCullDistanceAtReference( spv_result_t BuiltInsValidator::ValidateFragCoordAtDefinition( const Decoration& decoration, const Instruction& inst) { - if (spvIsVulkanEnv(_.context()->target_env)) { + if (spvIsVulkanOrWebGPUEnv(_.context()->target_env)) { if (spv_result_t error = ValidateF32Vec( decoration, inst, 4, [this, &inst](const std::string& message) -> spv_result_t { return _.diag(SPV_ERROR_INVALID_DATA, &inst) - << "According to the Vulkan spec BuiltIn FragCoord " + << "According to the " + << spvLogStringForEnv(_.context()->target_env) + << " spec BuiltIn FragCoord " "variable needs to be a 4-component 32-bit float " "vector. " << message; @@ -959,12 +990,13 @@ spv_result_t BuiltInsValidator::ValidateFragCoordAtReference( const Decoration& decoration, const Instruction& built_in_inst, const Instruction& referenced_inst, const Instruction& referenced_from_inst) { - if (spvIsVulkanEnv(_.context()->target_env)) { + if (spvIsVulkanOrWebGPUEnv(_.context()->target_env)) { const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); if (storage_class != SpvStorageClassMax && storage_class != SpvStorageClassInput) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) - << "Vulkan spec allows BuiltIn FragCoord to be only used for " + << spvLogStringForEnv(_.context()->target_env) + << " spec allows BuiltIn FragCoord to be only used for " "variables with Input storage class. " << GetReferenceDesc(decoration, built_in_inst, referenced_inst, referenced_from_inst) @@ -974,7 +1006,8 @@ spv_result_t BuiltInsValidator::ValidateFragCoordAtReference( for (const SpvExecutionModel execution_model : execution_models_) { if (execution_model != SpvExecutionModelFragment) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) - << "Vulkan spec allows BuiltIn FragCoord to be used only with " + << spvLogStringForEnv(_.context()->target_env) + << " spec allows BuiltIn FragCoord to be used only with " "Fragment execution model. " << GetReferenceDesc(decoration, built_in_inst, referenced_inst, referenced_from_inst, execution_model); @@ -994,12 +1027,14 @@ spv_result_t BuiltInsValidator::ValidateFragCoordAtReference( spv_result_t BuiltInsValidator::ValidateFragDepthAtDefinition( const Decoration& decoration, const Instruction& inst) { - if (spvIsVulkanEnv(_.context()->target_env)) { + if (spvIsVulkanOrWebGPUEnv(_.context()->target_env)) { if (spv_result_t error = ValidateF32( decoration, inst, [this, &inst](const std::string& message) -> spv_result_t { return _.diag(SPV_ERROR_INVALID_DATA, &inst) - << "According to the Vulkan spec BuiltIn FragDepth " + << "According to the " + << spvLogStringForEnv(_.context()->target_env) + << " spec BuiltIn FragDepth " "variable needs to be a 32-bit float scalar. " << message; })) { @@ -1015,12 +1050,13 @@ spv_result_t BuiltInsValidator::ValidateFragDepthAtReference( const Decoration& decoration, const Instruction& built_in_inst, const Instruction& referenced_inst, const Instruction& referenced_from_inst) { - if (spvIsVulkanEnv(_.context()->target_env)) { + if (spvIsVulkanOrWebGPUEnv(_.context()->target_env)) { const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); if (storage_class != SpvStorageClassMax && storage_class != SpvStorageClassOutput) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) - << "Vulkan spec allows BuiltIn FragDepth to be only used for " + << spvLogStringForEnv(_.context()->target_env) + << " spec allows BuiltIn FragDepth to be only used for " "variables with Output storage class. " << GetReferenceDesc(decoration, built_in_inst, referenced_inst, referenced_from_inst) @@ -1030,7 +1066,8 @@ spv_result_t BuiltInsValidator::ValidateFragDepthAtReference( for (const SpvExecutionModel execution_model : execution_models_) { if (execution_model != SpvExecutionModelFragment) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) - << "Vulkan spec allows BuiltIn FragDepth to be used only with " + << spvLogStringForEnv(_.context()->target_env) + << " spec allows BuiltIn FragDepth to be used only with " "Fragment execution model. " << GetReferenceDesc(decoration, built_in_inst, referenced_inst, referenced_from_inst, execution_model); @@ -1043,7 +1080,8 @@ spv_result_t BuiltInsValidator::ValidateFragDepthAtReference( const auto* modes = _.GetExecutionModes(entry_point); if (!modes || !modes->count(SpvExecutionModeDepthReplacing)) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) - << "Vulkan spec requires DepthReplacing execution mode to be " + << spvLogStringForEnv(_.context()->target_env) + << " spec requires DepthReplacing execution mode to be " "declared when using BuiltIn FragDepth. " << GetReferenceDesc(decoration, built_in_inst, referenced_inst, referenced_from_inst); @@ -1063,12 +1101,14 @@ spv_result_t BuiltInsValidator::ValidateFragDepthAtReference( spv_result_t BuiltInsValidator::ValidateFrontFacingAtDefinition( const Decoration& decoration, const Instruction& inst) { - if (spvIsVulkanEnv(_.context()->target_env)) { + if (spvIsVulkanOrWebGPUEnv(_.context()->target_env)) { if (spv_result_t error = ValidateBool( decoration, inst, [this, &inst](const std::string& message) -> spv_result_t { return _.diag(SPV_ERROR_INVALID_DATA, &inst) - << "According to the Vulkan spec BuiltIn FrontFacing " + << "According to the " + << spvLogStringForEnv(_.context()->target_env) + << " spec BuiltIn FrontFacing " "variable needs to be a bool scalar. " << message; })) { @@ -1084,12 +1124,13 @@ spv_result_t BuiltInsValidator::ValidateFrontFacingAtReference( const Decoration& decoration, const Instruction& built_in_inst, const Instruction& referenced_inst, const Instruction& referenced_from_inst) { - if (spvIsVulkanEnv(_.context()->target_env)) { + if (spvIsVulkanOrWebGPUEnv(_.context()->target_env)) { const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); if (storage_class != SpvStorageClassMax && storage_class != SpvStorageClassInput) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) - << "Vulkan spec allows BuiltIn FrontFacing to be only used for " + << spvLogStringForEnv(_.context()->target_env) + << " spec allows BuiltIn FrontFacing to be only used for " "variables with Input storage class. " << GetReferenceDesc(decoration, built_in_inst, referenced_inst, referenced_from_inst) @@ -1099,7 +1140,8 @@ spv_result_t BuiltInsValidator::ValidateFrontFacingAtReference( for (const SpvExecutionModel execution_model : execution_models_) { if (execution_model != SpvExecutionModelFragment) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) - << "Vulkan spec allows BuiltIn FrontFacing to be used only with " + << spvLogStringForEnv(_.context()->target_env) + << " spec allows BuiltIn FrontFacing to be used only with " "Fragment execution model. " << GetReferenceDesc(decoration, built_in_inst, referenced_inst, referenced_from_inst, execution_model); @@ -1233,12 +1275,14 @@ spv_result_t BuiltInsValidator::ValidateInvocationIdAtReference( spv_result_t BuiltInsValidator::ValidateInstanceIndexAtDefinition( const Decoration& decoration, const Instruction& inst) { - if (spvIsVulkanEnv(_.context()->target_env)) { + if (spvIsVulkanOrWebGPUEnv(_.context()->target_env)) { if (spv_result_t error = ValidateI32( decoration, inst, [this, &inst](const std::string& message) -> spv_result_t { return _.diag(SPV_ERROR_INVALID_DATA, &inst) - << "According to the Vulkan spec BuiltIn InstanceIndex " + << "According to the " + << spvLogStringForEnv(_.context()->target_env) + << " spec BuiltIn InstanceIndex " "variable needs to be a 32-bit int scalar. " << message; })) { @@ -1254,12 +1298,13 @@ spv_result_t BuiltInsValidator::ValidateInstanceIndexAtReference( const Decoration& decoration, const Instruction& built_in_inst, const Instruction& referenced_inst, const Instruction& referenced_from_inst) { - if (spvIsVulkanEnv(_.context()->target_env)) { + if (spvIsVulkanOrWebGPUEnv(_.context()->target_env)) { const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); if (storage_class != SpvStorageClassMax && storage_class != SpvStorageClassInput) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) - << "Vulkan spec allows BuiltIn InstanceIndex to be only used for " + << spvLogStringForEnv(_.context()->target_env) + << " spec allows BuiltIn InstanceIndex to be only used for " "variables with Input storage class. " << GetReferenceDesc(decoration, built_in_inst, referenced_inst, referenced_from_inst) @@ -1269,7 +1314,8 @@ spv_result_t BuiltInsValidator::ValidateInstanceIndexAtReference( for (const SpvExecutionModel execution_model : execution_models_) { if (execution_model != SpvExecutionModelVertex) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) - << "Vulkan spec allows BuiltIn InstanceIndex to be used only " + << spvLogStringForEnv(_.context()->target_env) + << " spec allows BuiltIn InstanceIndex to be used only " "with Vertex execution model. " << GetReferenceDesc(decoration, built_in_inst, referenced_inst, referenced_from_inst, execution_model); @@ -2115,13 +2161,15 @@ spv_result_t BuiltInsValidator::ValidateTessLevelAtReference( spv_result_t BuiltInsValidator::ValidateVertexIndexAtDefinition( const Decoration& decoration, const Instruction& inst) { - if (spvIsVulkanEnv(_.context()->target_env)) { + if (spvIsVulkanOrWebGPUEnv(_.context()->target_env)) { if (spv_result_t error = ValidateI32( decoration, inst, [this, &inst](const std::string& message) -> spv_result_t { return _.diag(SPV_ERROR_INVALID_DATA, &inst) - << "According to the Vulkan spec BuiltIn VertexIndex " - "variable needs to be a 32-bit int scalar. " + << "According to the " + << spvLogStringForEnv(_.context()->target_env) + << " spec BuiltIn VertexIndex variable needs to be a " + "32-bit int scalar. " << message; })) { return error; @@ -2183,16 +2231,75 @@ spv_result_t BuiltInsValidator::ValidateInstanceIdAtReference( return SPV_SUCCESS; } -spv_result_t BuiltInsValidator::ValidateVertexIndexAtReference( +spv_result_t BuiltInsValidator::ValidateLocalInvocationIndexAtDefinition( + const Decoration& decoration, const Instruction& inst) { + if (spvIsWebGPUEnv(_.context()->target_env)) { + if (spv_result_t error = ValidateI32( + decoration, inst, + [this, &inst](const std::string& message) -> spv_result_t { + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << "According to the WebGPU spec BuiltIn " + "LocalInvocationIndex variable needs to be a 32-bit " + "int." + << message; + })) { + return error; + } + } + + // Seed at reference checks with this built-in. + return ValidateLocalInvocationIndexAtReference(decoration, inst, inst, inst); +} + +spv_result_t BuiltInsValidator::ValidateLocalInvocationIndexAtReference( const Decoration& decoration, const Instruction& built_in_inst, const Instruction& referenced_inst, const Instruction& referenced_from_inst) { - if (spvIsVulkanEnv(_.context()->target_env)) { + if (spvIsWebGPUEnv(_.context()->target_env)) { const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); if (storage_class != SpvStorageClassMax && storage_class != SpvStorageClassInput) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) - << "Vulkan spec allows BuiltIn VertexIndex to be only used for " + << "WebGPU spec allows BuiltIn LocalInvocationIndex to be only " + "used for variables with Input storage class. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst) + << " " << GetStorageClassDesc(referenced_from_inst); + } + + for (const SpvExecutionModel execution_model : execution_models_) { + if (execution_model != SpvExecutionModelGLCompute) { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << "WebGPU spec allows BuiltIn VertexIndex to be used only " + "with GLCompute execution model. " + << GetReferenceDesc(decoration, built_in_inst, referenced_inst, + referenced_from_inst, execution_model); + } + } + } + + if (function_id_ == 0) { + // Propagate this rule to all dependant ids in the global scope. + id_to_at_reference_checks_[referenced_from_inst.id()].push_back( + std::bind(&BuiltInsValidator::ValidateLocalInvocationIndexAtReference, + this, decoration, built_in_inst, referenced_from_inst, + std::placeholders::_1)); + } + + return SPV_SUCCESS; +} + +spv_result_t BuiltInsValidator::ValidateVertexIndexAtReference( + const Decoration& decoration, const Instruction& built_in_inst, + const Instruction& referenced_inst, + const Instruction& referenced_from_inst) { + if (spvIsVulkanOrWebGPUEnv(_.context()->target_env)) { + const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); + if (storage_class != SpvStorageClassMax && + storage_class != SpvStorageClassInput) { + return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) + << spvLogStringForEnv(_.context()->target_env) + << " spec allows BuiltIn VertexIndex to be only used for " "variables with Input storage class. " << GetReferenceDesc(decoration, built_in_inst, referenced_inst, referenced_from_inst) @@ -2202,8 +2309,8 @@ spv_result_t BuiltInsValidator::ValidateVertexIndexAtReference( for (const SpvExecutionModel execution_model : execution_models_) { if (execution_model != SpvExecutionModelVertex) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) - << "Vulkan spec allows BuiltIn VertexIndex to be used only " - "with " + << spvLogStringForEnv(_.context()->target_env) + << " spec allows BuiltIn VertexIndex to be used only with " "Vertex execution model. " << GetReferenceDesc(decoration, built_in_inst, referenced_inst, referenced_from_inst, execution_model); @@ -2339,13 +2446,15 @@ spv_result_t BuiltInsValidator::ValidateLayerOrViewportIndexAtReference( spv_result_t BuiltInsValidator::ValidateComputeShaderI32Vec3InputAtDefinition( const Decoration& decoration, const Instruction& inst) { - if (spvIsVulkanEnv(_.context()->target_env)) { + if (spvIsVulkanOrWebGPUEnv(_.context()->target_env)) { if (spv_result_t error = ValidateI32Vec( decoration, inst, 3, [this, &decoration, &inst](const std::string& message) -> spv_result_t { return _.diag(SPV_ERROR_INVALID_DATA, &inst) - << "According to the Vulkan spec BuiltIn " + << "According to the " + << spvLogStringForEnv(_.context()->target_env) + << " spec BuiltIn " << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, decoration.params()[0]) << " variable needs to be a 3-component 32-bit int " @@ -2365,12 +2474,13 @@ spv_result_t BuiltInsValidator::ValidateComputeShaderI32Vec3InputAtReference( const Decoration& decoration, const Instruction& built_in_inst, const Instruction& referenced_inst, const Instruction& referenced_from_inst) { - if (spvIsVulkanEnv(_.context()->target_env)) { + if (spvIsVulkanOrWebGPUEnv(_.context()->target_env)) { const SpvStorageClass storage_class = GetStorageClass(referenced_from_inst); if (storage_class != SpvStorageClassMax && storage_class != SpvStorageClassInput) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) - << "Vulkan spec allows BuiltIn " + << spvLogStringForEnv(_.context()->target_env) + << " spec allows BuiltIn " << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, decoration.params()[0]) << " to be only used for variables with Input storage class. " @@ -2380,11 +2490,15 @@ spv_result_t BuiltInsValidator::ValidateComputeShaderI32Vec3InputAtReference( } for (const SpvExecutionModel execution_model : execution_models_) { - if (execution_model != SpvExecutionModelGLCompute && - execution_model != SpvExecutionModelTaskNV && - execution_model != SpvExecutionModelMeshNV) { + bool has_vulkan_model = execution_model == SpvExecutionModelGLCompute || + execution_model == SpvExecutionModelTaskNV || + execution_model == SpvExecutionModelMeshNV; + bool has_webgpu_model = execution_model == SpvExecutionModelGLCompute; + if ((spvIsVulkanEnv(_.context()->target_env) && !has_vulkan_model) || + (spvIsWebGPUEnv(_.context()->target_env) && !has_webgpu_model)) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) - << "Vulkan spec allows BuiltIn " + << spvLogStringForEnv(_.context()->target_env) + << " spec allows BuiltIn " << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, decoration.params()[0]) << " to be used only with GLCompute execution model. " @@ -2407,8 +2521,9 @@ spv_result_t BuiltInsValidator::ValidateComputeShaderI32Vec3InputAtReference( spv_result_t BuiltInsValidator::ValidateWorkgroupSizeAtDefinition( const Decoration& decoration, const Instruction& inst) { - if (spvIsVulkanEnv(_.context()->target_env)) { - if (!spvOpcodeIsConstant(inst.opcode())) { + if (spvIsVulkanOrWebGPUEnv(_.context()->target_env)) { + if (spvIsVulkanEnv(_.context()->target_env) && + !spvOpcodeIsConstant(inst.opcode())) { return _.diag(SPV_ERROR_INVALID_DATA, &inst) << "Vulkan spec requires BuiltIn WorkgroupSize to be a " "constant. " @@ -2419,9 +2534,10 @@ spv_result_t BuiltInsValidator::ValidateWorkgroupSizeAtDefinition( decoration, inst, 3, [this, &inst](const std::string& message) -> spv_result_t { return _.diag(SPV_ERROR_INVALID_DATA, &inst) - << "According to the Vulkan spec BuiltIn WorkgroupSize " - "variable " - "needs to be a 3-component 32-bit int vector. " + << "According to the " + << spvLogStringForEnv(_.context()->target_env) + << " spec BuiltIn WorkgroupSize variable needs to be a " + "3-component 32-bit int vector. " << message; })) { return error; @@ -2436,11 +2552,12 @@ spv_result_t BuiltInsValidator::ValidateWorkgroupSizeAtReference( const Decoration& decoration, const Instruction& built_in_inst, const Instruction& referenced_inst, const Instruction& referenced_from_inst) { - if (spvIsVulkanEnv(_.context()->target_env)) { + if (spvIsVulkanOrWebGPUEnv(_.context()->target_env)) { for (const SpvExecutionModel execution_model : execution_models_) { if (execution_model != SpvExecutionModelGLCompute) { return _.diag(SPV_ERROR_INVALID_DATA, &referenced_from_inst) - << "Vulkan spec allows BuiltIn " + << spvLogStringForEnv(_.context()->target_env) + << " spec allows BuiltIn " << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, decoration.params()[0]) << " to be used only with GLCompute execution model. " @@ -2463,6 +2580,15 @@ spv_result_t BuiltInsValidator::ValidateWorkgroupSizeAtReference( spv_result_t BuiltInsValidator::ValidateSingleBuiltInAtDefinition( const Decoration& decoration, const Instruction& inst) { const SpvBuiltIn label = SpvBuiltIn(decoration.params()[0]); + + if (spvIsWebGPUEnv(_.context()->target_env) && + !IsBuiltInValidForWebGPU(label)) { + return _.diag(SPV_ERROR_INVALID_DATA, &inst) + << "WebGPU does not allow BuiltIn " + << _.grammar().lookupOperandName(SPV_OPERAND_TYPE_BUILT_IN, + decoration.params()[0]); + } + // If you are adding a new BuiltIn enum, please register it here. // If the newly added enum has validation rules associated with it // consider leaving a TODO and/or creating an issue. @@ -2542,7 +2668,9 @@ spv_result_t BuiltInsValidator::ValidateSingleBuiltInAtDefinition( case SpvBuiltInInstanceId: { return ValidateVertexIdOrInstanceIdAtDefinition(decoration, inst); } - case SpvBuiltInLocalInvocationIndex: + case SpvBuiltInLocalInvocationIndex: { + return ValidateLocalInvocationIndexAtDefinition(decoration, inst); + } case SpvBuiltInWorkDim: case SpvBuiltInGlobalSize: case SpvBuiltInEnqueuedWorkgroupSize: diff --git a/3rdparty/spirv-tools/source/val/validate_decorations.cpp b/3rdparty/spirv-tools/source/val/validate_decorations.cpp index 164a5ddc9..f0ad17749 100644 --- a/3rdparty/spirv-tools/source/val/validate_decorations.cpp +++ b/3rdparty/spirv-tools/source/val/validate_decorations.cpp @@ -950,6 +950,14 @@ spv_result_t CheckDecorationsOfBuffers(ValidationState_t& vstate) { const bool bufferRules = (uniform && bufferDeco) || (push_constant && blockDeco) || ((storage_buffer || phys_storage_buffer) && blockDeco); + if (uniform && blockDeco) { + vstate.RegisterPointerToUniformBlock(ptrInst->id()); + vstate.RegisterStructForUniformBlock(id); + } + if ((uniform && bufferDeco) || (storage_buffer && blockDeco)) { + vstate.RegisterPointerToStorageBuffer(ptrInst->id()); + vstate.RegisterStructForStorageBuffer(id); + } if (blockRules || bufferRules) { const char* deco_str = blockDeco ? "Block" : "BufferBlock"; spv_result_t recursive_status = SPV_SUCCESS; @@ -1219,6 +1227,49 @@ spv_result_t CheckFPRoundingModeForShaders(ValidationState_t& vstate, return SPV_SUCCESS; } +// Returns SPV_SUCCESS if validation rules are satisfied for the NonWritable +// decoration. Otherwise emits a diagnostic and returns something other than +// SPV_SUCCESS. The |inst| parameter is the object being decorated. This must +// be called after TypePass and AnnotateCheckDecorationsOfBuffers are called. +spv_result_t CheckNonWritableDecoration(ValidationState_t& vstate, + const Instruction& inst, + const Decoration& decoration) { + assert(inst.id() && "Parser ensures the target of the decoration has an ID"); + + if (decoration.struct_member_index() == Decoration::kInvalidMember) { + // The target must be a memory object declaration. + // First, it must be a variable or function parameter. + if (inst.opcode() != SpvOpVariable && + inst.opcode() != SpvOpFunctionParameter) { + return vstate.diag(SPV_ERROR_INVALID_ID, &inst) + << "Target of NonWritable decoration must be a memory object " + "declaration (a variable or a function parameter)"; + } + // Second, it must point to a UBO, SSBO, or storage image. + const auto type_id = inst.type_id(); + if (!vstate.IsPointerToUniformBlock(type_id) && + !vstate.IsPointerToStorageBuffer(type_id) && + !vstate.IsPointerToStorageImage(type_id)) { + return vstate.diag(SPV_ERROR_INVALID_ID, &inst) + << "Target of NonWritable decoration is invalid: must point to a " + "storage image, uniform block, or storage buffer"; + } + } else { + // The target is a struct member. The annotations pass already checks that + // it is a structure. So now fall through to ensure that the structure is + // used as a UBO or SSBO. + const auto type_id = inst.id(); + if (!vstate.IsStructForUniformBlock(type_id) && + !vstate.IsStructForStorageBuffer(type_id)) { + return vstate.diag(SPV_ERROR_INVALID_ID, &inst) + << "Target of NonWritable member decoration is invalid: must be " + "the struct type of a uniform block or storage buffer"; + } + } + + return SPV_SUCCESS; +} + // Returns SPV_SUCCESS if validation rules are satisfied for Uniform // decorations. Otherwise emits a diagnostic and returns something other than // SPV_SUCCESS. Assumes each decoration on a group has been propagated down to @@ -1314,6 +1365,9 @@ spv_result_t CheckDecorationsFromDecoration(ValidationState_t& vstate) { if (is_shader) PASS_OR_BAIL(CheckFPRoundingModeForShaders(vstate, *inst)); break; + case SpvDecorationNonWritable: + PASS_OR_BAIL(CheckNonWritableDecoration(vstate, *inst, decoration)); + break; case SpvDecorationUniform: PASS_OR_BAIL(CheckUniformDecoration(vstate, *inst, decoration)); break; diff --git a/3rdparty/spirv-tools/source/val/validate_type.cpp b/3rdparty/spirv-tools/source/val/validate_type.cpp index 7669f72f0..30fc2fbd8 100644 --- a/3rdparty/spirv-tools/source/val/validate_type.cpp +++ b/3rdparty/spirv-tools/source/val/validate_type.cpp @@ -269,6 +269,16 @@ spv_result_t ValidateTypePointer(ValidationState_t& _, << "OpTypePointer Type '" << _.getIdName(type_id) << "' is not a type."; } + // See if this points to a storage image. + if (type->opcode() == SpvOpTypeImage) { + const auto storage_class = inst->GetOperandAs(1); + if (storage_class == SpvStorageClassUniformConstant) { + const auto sampled = type->GetOperandAs(6); + // 2 indicates this image is known to be be used without a sampler, i.e. + // a storage image. + if (sampled == 2) _.RegisterPointerToStorageImage(inst->id()); + } + } return SPV_SUCCESS; } diff --git a/3rdparty/spirv-tools/source/val/validation_state.h b/3rdparty/spirv-tools/source/val/validation_state.h index 2c94906b9..676b42308 100644 --- a/3rdparty/spirv-tools/source/val/validation_state.h +++ b/3rdparty/spirv-tools/source/val/validation_state.h @@ -562,6 +562,63 @@ class ValidationState_t { bool GetPointerTypeInfo(uint32_t id, uint32_t* data_type, uint32_t* storage_class) const; + // Is the ID the type of a pointer to a uniform block: Block-decorated struct + // in uniform storage class? The result is only valid after internal method + // CheckDecorationsOfBuffers has been called. + bool IsPointerToUniformBlock(uint32_t type_id) const { + return pointer_to_uniform_block_.find(type_id) != + pointer_to_uniform_block_.cend(); + } + // Save the ID of a pointer to uniform block. + void RegisterPointerToUniformBlock(uint32_t type_id) { + pointer_to_uniform_block_.insert(type_id); + } + // Is the ID the type of a struct used as a uniform block? + // The result is only valid after internal method CheckDecorationsOfBuffers + // has been called. + bool IsStructForUniformBlock(uint32_t type_id) const { + return struct_for_uniform_block_.find(type_id) != + struct_for_uniform_block_.cend(); + } + // Save the ID of a struct of a uniform block. + void RegisterStructForUniformBlock(uint32_t type_id) { + struct_for_uniform_block_.insert(type_id); + } + // Is the ID the type of a pointer to a storage buffer: BufferBlock-decorated + // struct in uniform storage class, or Block-decorated struct in StorageBuffer + // storage class? The result is only valid after internal method + // CheckDecorationsOfBuffers has been called. + bool IsPointerToStorageBuffer(uint32_t type_id) const { + return pointer_to_storage_buffer_.find(type_id) != + pointer_to_storage_buffer_.cend(); + } + // Save the ID of a pointer to a storage buffer. + void RegisterPointerToStorageBuffer(uint32_t type_id) { + pointer_to_storage_buffer_.insert(type_id); + } + // Is the ID the type of a struct for storage buffer? + // The result is only valid after internal method CheckDecorationsOfBuffers + // has been called. + bool IsStructForStorageBuffer(uint32_t type_id) const { + return struct_for_storage_buffer_.find(type_id) != + struct_for_storage_buffer_.cend(); + } + // Save the ID of a struct of a storage buffer. + void RegisterStructForStorageBuffer(uint32_t type_id) { + struct_for_storage_buffer_.insert(type_id); + } + + // Is the ID the type of a pointer to a storage image? That is, the pointee + // type is an image type which is known to not use a sampler. + bool IsPointerToStorageImage(uint32_t type_id) const { + return pointer_to_storage_image_.find(type_id) != + pointer_to_storage_image_.cend(); + } + // Save the ID of a pointer to a storage image. + void RegisterPointerToStorageImage(uint32_t type_id) { + pointer_to_storage_image_.insert(type_id); + } + // Tries to evaluate a 32-bit signed or unsigned scalar integer constant. // Returns tuple . // OpSpecConstant* return |is_const_int32| as false since their values cannot @@ -701,6 +758,23 @@ class ValidationState_t { std::unordered_map> function_to_entry_points_; const std::vector empty_ids_; + // The IDs of types of pointers to Block-decorated structs in Uniform storage + // class. This is populated at the start of ValidateDecorations. + std::unordered_set pointer_to_uniform_block_; + // The IDs of struct types for uniform blocks. + // This is populated at the start of ValidateDecorations. + std::unordered_set struct_for_uniform_block_; + // The IDs of types of pointers to BufferBlock-decorated structs in Uniform + // storage class, or Block-decorated structs in StorageBuffer storage class. + // This is populated at the start of ValidateDecorations. + std::unordered_set pointer_to_storage_buffer_; + // The IDs of struct types for storage buffers. + // This is populated at the start of ValidateDecorations. + std::unordered_set struct_for_storage_buffer_; + // The IDs of types of pointers to storage images. This is populated in the + // TypePass. + std::unordered_set pointer_to_storage_image_; + /// Maps ids to friendly names. std::unique_ptr friendly_mapper_; spvtools::NameMapper name_mapper_; diff --git a/3rdparty/spirv-tools/test/assembly_context_test.cpp b/3rdparty/spirv-tools/test/assembly_context_test.cpp index b6d60b95d..ee0bb24a9 100644 --- a/3rdparty/spirv-tools/test/assembly_context_test.cpp +++ b/3rdparty/spirv-tools/test/assembly_context_test.cpp @@ -46,7 +46,7 @@ TEST_P(EncodeStringTest, Sample) { } // clang-format off -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( BinaryEncodeString, EncodeStringTest, ::testing::ValuesIn(std::vector{ // Use cases that exercise at least one to two words, @@ -70,7 +70,7 @@ INSTANTIATE_TEST_CASE_P( // A very long string, encoded after an initial word. // SPIR-V limits strings to 65535 characters. {std::string(65535, 'a'), {1}}, - }),); + })); // clang-format on } // namespace diff --git a/3rdparty/spirv-tools/test/binary_parse_test.cpp b/3rdparty/spirv-tools/test/binary_parse_test.cpp index 749e12fd6..b9661023e 100644 --- a/3rdparty/spirv-tools/test/binary_parse_test.cpp +++ b/3rdparty/spirv-tools/test/binary_parse_test.cpp @@ -561,7 +561,7 @@ TEST_P(BinaryParseWordsAndCountDiagnosticTest, WordAndCountCases) { EXPECT_THAT(diagnostic->error, Eq(GetParam().expected_diagnostic)); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( BinaryParseDiagnostic, BinaryParseWordsAndCountDiagnosticTest, ::testing::ValuesIn(std::vector{ {nullptr, 0, "Missing module."}, @@ -575,7 +575,7 @@ INSTANTIATE_TEST_CASE_P( "Module has incomplete header: only 3 words instead of 5"}, {kHeaderForBound1, 4, "Module has incomplete header: only 4 words instead of 5"}, - }), ); + })); // A binary parser diagnostic test case where a vector of words is // provided. We'll use this to express cases that can't be created @@ -598,7 +598,7 @@ TEST_P(BinaryParseWordVectorDiagnosticTest, WordVectorCases) { EXPECT_THAT(diagnostic->error, Eq(GetParam().expected_diagnostic)); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( BinaryParseDiagnostic, BinaryParseWordVectorDiagnosticTest, ::testing::ValuesIn(std::vector{ {Concatenate({ExpectedHeaderForBound(1), {spvOpcodeMake(0, SpvOpNop)}}), @@ -816,7 +816,7 @@ INSTANTIATE_TEST_CASE_P( MakeInstruction(SpvOpConstant, {1, 2, 42}), }), "Type Id 1 is not a scalar numeric type"}, - }), ); + })); // A binary parser diagnostic case generated from an assembly text input. struct AssemblyDiagnosticCase { @@ -836,7 +836,7 @@ TEST_P(BinaryParseAssemblyDiagnosticTest, AssemblyCases) { EXPECT_THAT(diagnostic->error, Eq(GetParam().expected_diagnostic)); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( BinaryParseDiagnostic, BinaryParseAssemblyDiagnosticTest, ::testing::ValuesIn(std::vector{ {"%1 = OpConstant !0 42", "Error: Type Id is 0"}, @@ -886,7 +886,7 @@ INSTANTIATE_TEST_CASE_P( "Invalid image operand: 32770 has invalid mask component 32768"}, {"OpSelectionMerge %1 !7", "Invalid selection control operand: 7 has invalid mask component 4"}, - }), ); + })); } // namespace } // namespace spvtools diff --git a/3rdparty/spirv-tools/test/binary_to_text.literal_test.cpp b/3rdparty/spirv-tools/test/binary_to_text.literal_test.cpp index bcfb0f016..02daac761 100644 --- a/3rdparty/spirv-tools/test/binary_to_text.literal_test.cpp +++ b/3rdparty/spirv-tools/test/binary_to_text.literal_test.cpp @@ -32,7 +32,7 @@ TEST_P(RoundTripLiteralsTest, Sample) { } // clang-format off -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( StringLiterals, RoundTripLiteralsTest, ::testing::ValuesIn(std::vector{ "OpName %1 \"\"\n", // empty @@ -49,7 +49,7 @@ INSTANTIATE_TEST_CASE_P( "OpName %1 \"\\\"foo\nbar\\\"\"\n", // escaped quote "OpName %1 \"\\\\foo\nbar\\\\\"\n", // escaped backslash "OpName %1 \"\xE4\xBA\xB2\"\n", // UTF-8 - }),); + })); // clang-format on using RoundTripSpecialCaseLiteralsTest = spvtest::TextToBinaryTestBase< @@ -63,13 +63,13 @@ TEST_P(RoundTripSpecialCaseLiteralsTest, Sample) { } // clang-format off -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( StringLiterals, RoundTripSpecialCaseLiteralsTest, ::testing::ValuesIn(std::vector>{ {"OpName %1 \"\\foo\"\n", "OpName %1 \"foo\"\n"}, // Escape f {"OpName %1 \"\\\nfoo\"\n", "OpName %1 \"\nfoo\"\n"}, // Escape newline {"OpName %1 \"\\\xE4\xBA\xB2\"\n", "OpName %1 \"\xE4\xBA\xB2\"\n"}, // Escape utf-8 - }),); + })); // clang-format on } // namespace diff --git a/3rdparty/spirv-tools/test/binary_to_text_test.cpp b/3rdparty/spirv-tools/test/binary_to_text_test.cpp index 00ac86bbd..e8a02fd59 100644 --- a/3rdparty/spirv-tools/test/binary_to_text_test.cpp +++ b/3rdparty/spirv-tools/test/binary_to_text_test.cpp @@ -171,7 +171,7 @@ TEST_P(BinaryToTextFail, EncodeSuccessfullyDecodeFailed) { Eq(GetParam().expected_error_message)); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( InvalidIds, BinaryToTextFail, ::testing::ValuesIn(std::vector{ {"", spvtest::MakeInstruction(SpvOpTypeVoid, {0}), @@ -196,9 +196,9 @@ INSTANTIATE_TEST_CASE_P( "%2 = OpTypeVector %1 4", spvtest::MakeInstruction(SpvOpConstant, {2, 3, 999}), "Type Id 2 is not a scalar numeric type"}, - }), ); + })); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( InvalidIdsCheckedDuringLiteralCaseParsing, BinaryToTextFail, ::testing::ValuesIn(std::vector{ {"", spvtest::MakeInstruction(SpvOpSwitch, {1, 2, 3, 4}), @@ -212,7 +212,7 @@ INSTANTIATE_TEST_CASE_P( {"%1 = OpTypeFloat 32\n%2 = OpConstant %1 1.5", spvtest::MakeInstruction(SpvOpSwitch, {2, 3, 4, 5}), "Invalid OpSwitch: selector id 2 is not a scalar integer"}, - }), ); + })); TEST_F(TextToBinaryTest, OneInstruction) { const std::string input = "OpSource OpenCL_C 12\n"; @@ -243,7 +243,7 @@ TEST_P(RoundTripInstructionsTest, Sample) { } // clang-format off -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( NumericLiterals, RoundTripInstructionsTest, // This test is independent of environment, so just test the one. Combine(::testing::Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1, @@ -275,10 +275,10 @@ INSTANTIATE_TEST_CASE_P( "%1 = OpTypeFloat 64\n%2 = OpConstant %1 -0x1.0002p+1024\n", // NaN "%1 = OpTypeFloat 64\n%2 = OpConstant %1 0x1p+1024\n", // Inf "%1 = OpTypeFloat 64\n%2 = OpConstant %1 -0x1p+1024\n", // -Inf - })), ); + }))); // clang-format on -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( MemoryAccessMasks, RoundTripInstructionsTest, Combine(::testing::Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1, SPV_ENV_UNIVERSAL_1_2, SPV_ENV_UNIVERSAL_1_3), @@ -292,9 +292,9 @@ INSTANTIATE_TEST_CASE_P( "OpStore %1 %2 Volatile|Aligned 16\n", "OpStore %1 %2 Volatile|Nontemporal\n", "OpStore %1 %2 Volatile|Aligned|Nontemporal 32\n", - })), ); + }))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( FPFastMathModeMasks, RoundTripInstructionsTest, Combine( ::testing::Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1, @@ -310,9 +310,9 @@ INSTANTIATE_TEST_CASE_P( "OpDecorate %1 FPFastMathMode NotNaN|NotInf\n", "OpDecorate %1 FPFastMathMode NSZ|AllowRecip\n", "OpDecorate %1 FPFastMathMode NotNaN|NotInf|NSZ|AllowRecip|Fast\n", - })), ); + }))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( LoopControlMasks, RoundTripInstructionsTest, Combine(::testing::Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1, SPV_ENV_UNIVERSAL_1_3, SPV_ENV_UNIVERSAL_1_2), @@ -321,18 +321,18 @@ INSTANTIATE_TEST_CASE_P( "OpLoopMerge %1 %2 Unroll\n", "OpLoopMerge %1 %2 DontUnroll\n", "OpLoopMerge %1 %2 Unroll|DontUnroll\n", - })), ); + }))); -INSTANTIATE_TEST_CASE_P(LoopControlMasksV11, RoundTripInstructionsTest, - Combine(::testing::Values(SPV_ENV_UNIVERSAL_1_1, - SPV_ENV_UNIVERSAL_1_2, - SPV_ENV_UNIVERSAL_1_3), - ::testing::ValuesIn(std::vector{ - "OpLoopMerge %1 %2 DependencyInfinite\n", - "OpLoopMerge %1 %2 DependencyLength 8\n", - })), ); +INSTANTIATE_TEST_SUITE_P(LoopControlMasksV11, RoundTripInstructionsTest, + Combine(::testing::Values(SPV_ENV_UNIVERSAL_1_1, + SPV_ENV_UNIVERSAL_1_2, + SPV_ENV_UNIVERSAL_1_3), + ::testing::ValuesIn(std::vector{ + "OpLoopMerge %1 %2 DependencyInfinite\n", + "OpLoopMerge %1 %2 DependencyLength 8\n", + }))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SelectionControlMasks, RoundTripInstructionsTest, Combine(::testing::Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1, SPV_ENV_UNIVERSAL_1_3, SPV_ENV_UNIVERSAL_1_2), @@ -341,9 +341,9 @@ INSTANTIATE_TEST_CASE_P( "OpSelectionMerge %1 Flatten\n", "OpSelectionMerge %1 DontFlatten\n", "OpSelectionMerge %1 Flatten|DontFlatten\n", - })), ); + }))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( FunctionControlMasks, RoundTripInstructionsTest, Combine(::testing::Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1, SPV_ENV_UNIVERSAL_1_2, SPV_ENV_UNIVERSAL_1_3), @@ -355,9 +355,9 @@ INSTANTIATE_TEST_CASE_P( "%2 = OpFunction %1 Const %3\n", "%2 = OpFunction %1 Inline|Pure|Const %3\n", "%2 = OpFunction %1 DontInline|Const %3\n", - })), ); + }))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ImageMasks, RoundTripInstructionsTest, Combine(::testing::Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1, SPV_ENV_UNIVERSAL_1_2, SPV_ENV_UNIVERSAL_1_3), @@ -378,9 +378,9 @@ INSTANTIATE_TEST_CASE_P( "%2 = OpImageFetch %1 %3 %4 Sample|MinLod %5 %6\n", "%2 = OpImageFetch %1 %3 %4" " Bias|Lod|Grad|ConstOffset|Offset|ConstOffsets|Sample|MinLod" - " %5 %6 %7 %8 %9 %10 %11 %12 %13\n"})), ); + " %5 %6 %7 %8 %9 %10 %11 %12 %13\n"}))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( NewInstructionsInSPIRV1_2, RoundTripInstructionsTest, Combine(::testing::Values(SPV_ENV_UNIVERSAL_1_2, SPV_ENV_UNIVERSAL_1_3), ::testing::ValuesIn(std::vector{ @@ -389,7 +389,7 @@ INSTANTIATE_TEST_CASE_P( "OpExecutionModeId %1 LocalSizeHintId %2\n", "OpDecorateId %1 AlignmentId %2\n", "OpDecorateId %1 MaxByteOffsetId %2\n", - })), ); + }))); using MaskSorting = TextToBinaryTest; @@ -537,23 +537,23 @@ TEST_P(GeneratorStringTest, Sample) { spvTextDestroy(decoded_text); } -INSTANTIATE_TEST_CASE_P(GeneratorStrings, GeneratorStringTest, - ::testing::ValuesIn(std::vector{ - {SPV_GENERATOR_KHRONOS, 12, "Khronos; 12"}, - {SPV_GENERATOR_LUNARG, 99, "LunarG; 99"}, - {SPV_GENERATOR_VALVE, 1, "Valve; 1"}, - {SPV_GENERATOR_CODEPLAY, 65535, "Codeplay; 65535"}, - {SPV_GENERATOR_NVIDIA, 19, "NVIDIA; 19"}, - {SPV_GENERATOR_ARM, 1000, "ARM; 1000"}, - {SPV_GENERATOR_KHRONOS_LLVM_TRANSLATOR, 38, - "Khronos LLVM/SPIR-V Translator; 38"}, - {SPV_GENERATOR_KHRONOS_ASSEMBLER, 2, - "Khronos SPIR-V Tools Assembler; 2"}, - {SPV_GENERATOR_KHRONOS_GLSLANG, 1, - "Khronos Glslang Reference Front End; 1"}, - {1000, 18, "Unknown(1000); 18"}, - {65535, 32767, "Unknown(65535); 32767"}, - }), ); +INSTANTIATE_TEST_SUITE_P(GeneratorStrings, GeneratorStringTest, + ::testing::ValuesIn(std::vector{ + {SPV_GENERATOR_KHRONOS, 12, "Khronos; 12"}, + {SPV_GENERATOR_LUNARG, 99, "LunarG; 99"}, + {SPV_GENERATOR_VALVE, 1, "Valve; 1"}, + {SPV_GENERATOR_CODEPLAY, 65535, "Codeplay; 65535"}, + {SPV_GENERATOR_NVIDIA, 19, "NVIDIA; 19"}, + {SPV_GENERATOR_ARM, 1000, "ARM; 1000"}, + {SPV_GENERATOR_KHRONOS_LLVM_TRANSLATOR, 38, + "Khronos LLVM/SPIR-V Translator; 38"}, + {SPV_GENERATOR_KHRONOS_ASSEMBLER, 2, + "Khronos SPIR-V Tools Assembler; 2"}, + {SPV_GENERATOR_KHRONOS_GLSLANG, 1, + "Khronos Glslang Reference Front End; 1"}, + {1000, 18, "Unknown(1000); 18"}, + {65535, 32767, "Unknown(65535); 32767"}, + })); // TODO(dneto): Test new instructions and enums in SPIR-V 1.3 diff --git a/3rdparty/spirv-tools/test/comp/markv_codec_test.cpp b/3rdparty/spirv-tools/test/comp/markv_codec_test.cpp index 283fcd3ca..a7af61710 100644 --- a/3rdparty/spirv-tools/test/comp/markv_codec_test.cpp +++ b/3rdparty/spirv-tools/test/comp/markv_codec_test.cpp @@ -817,12 +817,12 @@ OpFunctionEnd )"); } -INSTANTIATE_TEST_CASE_P(AllMarkvModels, MarkvTest, - ::testing::ValuesIn(std::vector{ - kMarkvModelShaderLite, - kMarkvModelShaderMid, - kMarkvModelShaderMax, - }), ); +INSTANTIATE_TEST_SUITE_P(AllMarkvModels, MarkvTest, + ::testing::ValuesIn(std::vector{ + kMarkvModelShaderLite, + kMarkvModelShaderMid, + kMarkvModelShaderMax, + })); } // namespace } // namespace comp diff --git a/3rdparty/spirv-tools/test/enum_set_test.cpp b/3rdparty/spirv-tools/test/enum_set_test.cpp index ddacd4214..047d6427c 100644 --- a/3rdparty/spirv-tools/test/enum_set_test.cpp +++ b/3rdparty/spirv-tools/test/enum_set_test.cpp @@ -267,24 +267,24 @@ TEST_P(CapabilitySetForEachTest, OperatorEqualsSelfAssign) { EXPECT_THAT(ElementsIn(assigned), Eq(GetParam().expected)); } -INSTANTIATE_TEST_CASE_P(Samples, CapabilitySetForEachTest, - ValuesIn(std::vector{ - {{}, {}}, - {{SpvCapabilityMatrix}, {SpvCapabilityMatrix}}, - {{SpvCapabilityKernel, SpvCapabilityShader}, - {SpvCapabilityShader, SpvCapabilityKernel}}, - {{static_cast(999)}, - {static_cast(999)}}, - {{static_cast(0x7fffffff)}, - {static_cast(0x7fffffff)}}, - // Mixture and out of order - {{static_cast(0x7fffffff), - static_cast(100), - SpvCapabilityShader, SpvCapabilityMatrix}, - {SpvCapabilityMatrix, SpvCapabilityShader, - static_cast(100), - static_cast(0x7fffffff)}}, - }), ); +INSTANTIATE_TEST_SUITE_P(Samples, CapabilitySetForEachTest, + ValuesIn(std::vector{ + {{}, {}}, + {{SpvCapabilityMatrix}, {SpvCapabilityMatrix}}, + {{SpvCapabilityKernel, SpvCapabilityShader}, + {SpvCapabilityShader, SpvCapabilityKernel}}, + {{static_cast(999)}, + {static_cast(999)}}, + {{static_cast(0x7fffffff)}, + {static_cast(0x7fffffff)}}, + // Mixture and out of order + {{static_cast(0x7fffffff), + static_cast(100), + SpvCapabilityShader, SpvCapabilityMatrix}, + {SpvCapabilityMatrix, SpvCapabilityShader, + static_cast(100), + static_cast(0x7fffffff)}}, + })); } // namespace } // namespace spvtools diff --git a/3rdparty/spirv-tools/test/enum_string_mapping_test.cpp b/3rdparty/spirv-tools/test/enum_string_mapping_test.cpp index b525d6014..a0379c18c 100644 --- a/3rdparty/spirv-tools/test/enum_string_mapping_test.cpp +++ b/3rdparty/spirv-tools/test/enum_string_mapping_test.cpp @@ -64,7 +64,7 @@ TEST_P(CapabilityTest, TestCapabilityToString) { EXPECT_EQ(capability_str, result_str); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( AllExtensions, ExtensionTest, ValuesIn(std::vector>({ {Extension::kSPV_KHR_16bit_storage, "SPV_KHR_16bit_storage"}, @@ -89,13 +89,13 @@ INSTANTIATE_TEST_CASE_P( {Extension::kSPV_KHR_8bit_storage, "SPV_KHR_8bit_storage"}, }))); -INSTANTIATE_TEST_CASE_P(UnknownExtensions, UnknownExtensionTest, - Values("", "SPV_KHR_", "SPV_KHR_device_group_ERROR", - /*alphabetically before all extensions*/ "A", - /*alphabetically after all extensions*/ "Z", - "SPV_ERROR_random_string_hfsdklhlktherh")); +INSTANTIATE_TEST_SUITE_P(UnknownExtensions, UnknownExtensionTest, + Values("", "SPV_KHR_", "SPV_KHR_device_group_ERROR", + /*alphabetically before all extensions*/ "A", + /*alphabetically after all extensions*/ "Z", + "SPV_ERROR_random_string_hfsdklhlktherh")); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( AllCapabilities, CapabilityTest, ValuesIn(std::vector>( {{SpvCapabilityMatrix, "Matrix"}, @@ -189,7 +189,7 @@ INSTANTIATE_TEST_CASE_P( "ShaderViewportIndexLayerEXT"}, {SpvCapabilityShaderViewportMaskNV, "ShaderViewportMaskNV"}, {SpvCapabilityShaderStereoViewNV, "ShaderStereoViewNV"}, - {SpvCapabilityPerViewAttributesNV, "PerViewAttributesNV"}})), ); + {SpvCapabilityPerViewAttributesNV, "PerViewAttributesNV"}}))); } // namespace } // namespace spvtools diff --git a/3rdparty/spirv-tools/test/ext_inst.debuginfo_test.cpp b/3rdparty/spirv-tools/test/ext_inst.debuginfo_test.cpp index 15fa8f765..ec012e0ea 100644 --- a/3rdparty/spirv-tools/test/ext_inst.debuginfo_test.cpp +++ b/3rdparty/spirv-tools/test/ext_inst.debuginfo_test.cpp @@ -368,30 +368,30 @@ TEST_P(ExtInstDebugInfoRoundTripTest, ParameterizedExtInst) { } // DebugInfo 4.1 Absent Debugging Information -INSTANTIATE_TEST_CASE_P(DebugInfoDebugInfoNone, ExtInstDebugInfoRoundTripTest, - ::testing::ValuesIn(std::vector({ - CASE_0(InfoNone), // enum value 0 - })), ); +INSTANTIATE_TEST_SUITE_P(DebugInfoDebugInfoNone, ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_0(InfoNone), // enum value 0 + }))); // DebugInfo 4.2 Compilation Unit -INSTANTIATE_TEST_CASE_P(DebugInfoDebugCompilationUnit, - ExtInstDebugInfoRoundTripTest, - ::testing::ValuesIn(std::vector({ - CASE_ILL(CompilationUnit, 100, 42), - })), ); +INSTANTIATE_TEST_SUITE_P(DebugInfoDebugCompilationUnit, + ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_ILL(CompilationUnit, 100, 42), + }))); // DebugInfo 4.3 Type instructions -INSTANTIATE_TEST_CASE_P(DebugInfoDebugTypeBasic, ExtInstDebugInfoRoundTripTest, - ::testing::ValuesIn(std::vector({ - CASE_IIE(TypeBasic, Unspecified), - CASE_IIE(TypeBasic, Address), - CASE_IIE(TypeBasic, Boolean), - CASE_IIE(TypeBasic, Float), - CASE_IIE(TypeBasic, Signed), - CASE_IIE(TypeBasic, SignedChar), - CASE_IIE(TypeBasic, Unsigned), - CASE_IIE(TypeBasic, UnsignedChar), - })), ); +INSTANTIATE_TEST_SUITE_P(DebugInfoDebugTypeBasic, ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_IIE(TypeBasic, Unspecified), + CASE_IIE(TypeBasic, Address), + CASE_IIE(TypeBasic, Boolean), + CASE_IIE(TypeBasic, Float), + CASE_IIE(TypeBasic, Signed), + CASE_IIE(TypeBasic, SignedChar), + CASE_IIE(TypeBasic, Unsigned), + CASE_IIE(TypeBasic, UnsignedChar), + }))); // The FlagIsPublic is value is (1 << 0) | (1 << 2) which is the same // as the bitwise-OR of FlagIsProtected and FlagIsPrivate. @@ -417,7 +417,7 @@ TEST_F(ExtInstDebugInfoRoundTripTestExplicit, FlagIsPublic) { EXPECT_THAT(EncodeAndDecodeSuccessfully(input), Eq(expected)) << input; } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( DebugInfoDebugTypePointer, ExtInstDebugInfoRoundTripTest, ::testing::ValuesIn(std::vector({ @@ -463,49 +463,50 @@ INSTANTIATE_TEST_CASE_P( uint32_t(DebugInfoFlagIndirectVariable) | uint32_t(DebugInfoFlagIsOptimized)), - })), ); + }))); -INSTANTIATE_TEST_CASE_P(DebugInfoDebugTypeQualifier, - ExtInstDebugInfoRoundTripTest, - ::testing::ValuesIn(std::vector({ - CASE_IE(TypeQualifier, ConstType), - CASE_IE(TypeQualifier, VolatileType), - CASE_IE(TypeQualifier, RestrictType), - })), ); +INSTANTIATE_TEST_SUITE_P(DebugInfoDebugTypeQualifier, + ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_IE(TypeQualifier, ConstType), + CASE_IE(TypeQualifier, VolatileType), + CASE_IE(TypeQualifier, RestrictType), + }))); -INSTANTIATE_TEST_CASE_P(DebugInfoDebugTypeArray, ExtInstDebugInfoRoundTripTest, - ::testing::ValuesIn(std::vector({ - CASE_II(TypeArray), - CASE_III(TypeArray), - CASE_IIII(TypeArray), - CASE_IIIII(TypeArray), - })), ); +INSTANTIATE_TEST_SUITE_P(DebugInfoDebugTypeArray, ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_II(TypeArray), + CASE_III(TypeArray), + CASE_IIII(TypeArray), + CASE_IIIII(TypeArray), + }))); -INSTANTIATE_TEST_CASE_P(DebugInfoDebugTypeVector, ExtInstDebugInfoRoundTripTest, - ::testing::ValuesIn(std::vector({ - CASE_IL(TypeVector, 2), - CASE_IL(TypeVector, 3), - CASE_IL(TypeVector, 4), - CASE_IL(TypeVector, 16), - })), ); +INSTANTIATE_TEST_SUITE_P(DebugInfoDebugTypeVector, + ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_IL(TypeVector, 2), + CASE_IL(TypeVector, 3), + CASE_IL(TypeVector, 4), + CASE_IL(TypeVector, 16), + }))); -INSTANTIATE_TEST_CASE_P(DebugInfoDebugTypedef, ExtInstDebugInfoRoundTripTest, - ::testing::ValuesIn(std::vector({ - CASE_IIILLI(Typedef, 12, 13), - CASE_IIILLI(Typedef, 14, 99), - })), ); +INSTANTIATE_TEST_SUITE_P(DebugInfoDebugTypedef, ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_IIILLI(Typedef, 12, 13), + CASE_IIILLI(Typedef, 14, 99), + }))); -INSTANTIATE_TEST_CASE_P(DebugInfoDebugTypeFunction, - ExtInstDebugInfoRoundTripTest, - ::testing::ValuesIn(std::vector({ - CASE_I(TypeFunction), - CASE_II(TypeFunction), - CASE_III(TypeFunction), - CASE_IIII(TypeFunction), - CASE_IIIII(TypeFunction), - })), ); +INSTANTIATE_TEST_SUITE_P(DebugInfoDebugTypeFunction, + ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_I(TypeFunction), + CASE_II(TypeFunction), + CASE_III(TypeFunction), + CASE_IIII(TypeFunction), + CASE_IIIII(TypeFunction), + }))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( DebugInfoDebugTypeEnum, ExtInstDebugInfoRoundTripTest, ::testing::ValuesIn(std::vector({ CASE_IIILLIIFII( @@ -518,9 +519,9 @@ INSTANTIATE_TEST_CASE_P( uint32_t(DebugInfoFlagStaticMember)), CASE_IIILLIIFIIIIII(TypeEnum, 99, 1, "FlagStaticMember", uint32_t(DebugInfoFlagStaticMember)), - })), ); + }))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( DebugInfoDebugTypeComposite, ExtInstDebugInfoRoundTripTest, ::testing::ValuesIn(std::vector({ CASE_IEILLIIF( @@ -545,22 +546,22 @@ INSTANTIATE_TEST_CASE_P( uint32_t(DebugInfoFlagIsPrivate)), CASE_IEILLIIFIIII(TypeComposite, Class, 9, 10, "FlagIsPrivate", uint32_t(DebugInfoFlagIsPrivate)), - })), ); + }))); -INSTANTIATE_TEST_CASE_P(DebugInfoDebugTypeMember, ExtInstDebugInfoRoundTripTest, - ::testing::ValuesIn(std::vector({ - CASE_IIILLIIIF(TypeMember, 12, 13, "FlagIsPrivate", - uint32_t(DebugInfoFlagIsPrivate)), - CASE_IIILLIIIF(TypeMember, 99, 100, - "FlagIsPrivate|FlagFwdDecl", - uint32_t(DebugInfoFlagIsPrivate) | - uint32_t(DebugInfoFlagFwdDecl)), - // Add the optional Id argument. - CASE_IIILLIIIFI(TypeMember, 12, 13, "FlagIsPrivate", - uint32_t(DebugInfoFlagIsPrivate)), - })), ); +INSTANTIATE_TEST_SUITE_P( + DebugInfoDebugTypeMember, ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_IIILLIIIF(TypeMember, 12, 13, "FlagIsPrivate", + uint32_t(DebugInfoFlagIsPrivate)), + CASE_IIILLIIIF(TypeMember, 99, 100, "FlagIsPrivate|FlagFwdDecl", + uint32_t(DebugInfoFlagIsPrivate) | + uint32_t(DebugInfoFlagFwdDecl)), + // Add the optional Id argument. + CASE_IIILLIIIFI(TypeMember, 12, 13, "FlagIsPrivate", + uint32_t(DebugInfoFlagIsPrivate)), + }))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( DebugInfoDebugTypeInheritance, ExtInstDebugInfoRoundTripTest, ::testing::ValuesIn(std::vector({ CASE_IIIIF(TypeInheritance, "FlagIsPrivate", @@ -568,53 +569,53 @@ INSTANTIATE_TEST_CASE_P( CASE_IIIIF(TypeInheritance, "FlagIsPrivate|FlagFwdDecl", uint32_t(DebugInfoFlagIsPrivate) | uint32_t(DebugInfoFlagFwdDecl)), - })), ); + }))); -INSTANTIATE_TEST_CASE_P(DebugInfoDebugTypePtrToMember, - ExtInstDebugInfoRoundTripTest, - ::testing::ValuesIn(std::vector({ - CASE_II(TypePtrToMember), - })), ); +INSTANTIATE_TEST_SUITE_P(DebugInfoDebugTypePtrToMember, + ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_II(TypePtrToMember), + }))); // DebugInfo 4.4 Templates -INSTANTIATE_TEST_CASE_P(DebugInfoDebugTypeTemplate, - ExtInstDebugInfoRoundTripTest, - ::testing::ValuesIn(std::vector({ - CASE_II(TypeTemplate), - CASE_III(TypeTemplate), - CASE_IIII(TypeTemplate), - CASE_IIIII(TypeTemplate), - })), ); +INSTANTIATE_TEST_SUITE_P(DebugInfoDebugTypeTemplate, + ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_II(TypeTemplate), + CASE_III(TypeTemplate), + CASE_IIII(TypeTemplate), + CASE_IIIII(TypeTemplate), + }))); -INSTANTIATE_TEST_CASE_P(DebugInfoDebugTypeTemplateParameter, - ExtInstDebugInfoRoundTripTest, - ::testing::ValuesIn(std::vector({ - CASE_IIIILL(TypeTemplateParameter, 1, 2), - CASE_IIIILL(TypeTemplateParameter, 99, 102), - CASE_IIIILL(TypeTemplateParameter, 10, 7), - })), ); +INSTANTIATE_TEST_SUITE_P(DebugInfoDebugTypeTemplateParameter, + ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_IIIILL(TypeTemplateParameter, 1, 2), + CASE_IIIILL(TypeTemplateParameter, 99, 102), + CASE_IIIILL(TypeTemplateParameter, 10, 7), + }))); -INSTANTIATE_TEST_CASE_P(DebugInfoDebugTypeTemplateTemplateParameter, - ExtInstDebugInfoRoundTripTest, - ::testing::ValuesIn(std::vector({ - CASE_IIILL(TypeTemplateTemplateParameter, 1, 2), - CASE_IIILL(TypeTemplateTemplateParameter, 99, 102), - CASE_IIILL(TypeTemplateTemplateParameter, 10, 7), - })), ); +INSTANTIATE_TEST_SUITE_P(DebugInfoDebugTypeTemplateTemplateParameter, + ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_IIILL(TypeTemplateTemplateParameter, 1, 2), + CASE_IIILL(TypeTemplateTemplateParameter, 99, 102), + CASE_IIILL(TypeTemplateTemplateParameter, 10, 7), + }))); -INSTANTIATE_TEST_CASE_P(DebugInfoDebugTypeTemplateParameterPack, - ExtInstDebugInfoRoundTripTest, - ::testing::ValuesIn(std::vector({ - CASE_IILLI(TypeTemplateParameterPack, 1, 2), - CASE_IILLII(TypeTemplateParameterPack, 99, 102), - CASE_IILLIII(TypeTemplateParameterPack, 10, 7), - CASE_IILLIIII(TypeTemplateParameterPack, 10, 7), - })), ); +INSTANTIATE_TEST_SUITE_P(DebugInfoDebugTypeTemplateParameterPack, + ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_IILLI(TypeTemplateParameterPack, 1, 2), + CASE_IILLII(TypeTemplateParameterPack, 99, 102), + CASE_IILLIII(TypeTemplateParameterPack, 10, 7), + CASE_IILLIIII(TypeTemplateParameterPack, 10, 7), + }))); // DebugInfo 4.5 Global Variables -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( DebugInfoDebugGlobalVariable, ExtInstDebugInfoRoundTripTest, ::testing::ValuesIn(std::vector({ CASE_IIILLIIIF(GlobalVariable, 1, 2, "FlagIsOptimized", @@ -625,20 +626,20 @@ INSTANTIATE_TEST_CASE_P( uint32_t(DebugInfoFlagIsOptimized)), CASE_IIILLIIIFI(GlobalVariable, 42, 43, "FlagIsOptimized", uint32_t(DebugInfoFlagIsOptimized)), - })), ); + }))); // DebugInfo 4.6 Functions -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( DebugInfoDebugFunctionDeclaration, ExtInstDebugInfoRoundTripTest, ::testing::ValuesIn(std::vector({ CASE_IIILLIIF(FunctionDeclaration, 1, 2, "FlagIsOptimized", uint32_t(DebugInfoFlagIsOptimized)), CASE_IIILLIIF(FunctionDeclaration, 42, 43, "FlagFwdDecl", uint32_t(DebugInfoFlagFwdDecl)), - })), ); + }))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( DebugInfoDebugFunction, ExtInstDebugInfoRoundTripTest, ::testing::ValuesIn(std::vector({ CASE_IIILLIIFLI(Function, 1, 2, "FlagIsOptimized", @@ -650,65 +651,65 @@ INSTANTIATE_TEST_CASE_P( uint32_t(DebugInfoFlagIsOptimized), 3), CASE_IIILLIIFLII(Function, 42, 43, "FlagFwdDecl", uint32_t(DebugInfoFlagFwdDecl), 44), - })), ); + }))); // DebugInfo 4.7 Local Information -INSTANTIATE_TEST_CASE_P(DebugInfoDebugLexicalBlock, - ExtInstDebugInfoRoundTripTest, - ::testing::ValuesIn(std::vector({ - CASE_ILLII(LexicalBlock, 1, 2), - CASE_ILLII(LexicalBlock, 42, 43), - })), ); +INSTANTIATE_TEST_SUITE_P(DebugInfoDebugLexicalBlock, + ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_ILLII(LexicalBlock, 1, 2), + CASE_ILLII(LexicalBlock, 42, 43), + }))); -INSTANTIATE_TEST_CASE_P(DebugInfoDebugLexicalBlockDiscriminator, - ExtInstDebugInfoRoundTripTest, - ::testing::ValuesIn(std::vector({ - CASE_ILI(LexicalBlockDiscriminator, 1), - CASE_ILI(LexicalBlockDiscriminator, 42), - })), ); +INSTANTIATE_TEST_SUITE_P(DebugInfoDebugLexicalBlockDiscriminator, + ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_ILI(LexicalBlockDiscriminator, 1), + CASE_ILI(LexicalBlockDiscriminator, 42), + }))); -INSTANTIATE_TEST_CASE_P(DebugInfoDebugScope, ExtInstDebugInfoRoundTripTest, - ::testing::ValuesIn(std::vector({ - CASE_I(Scope), - CASE_II(Scope), - })), ); +INSTANTIATE_TEST_SUITE_P(DebugInfoDebugScope, ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_I(Scope), + CASE_II(Scope), + }))); -INSTANTIATE_TEST_CASE_P(DebugInfoDebugNoScope, ExtInstDebugInfoRoundTripTest, - ::testing::ValuesIn(std::vector({ - CASE_0(NoScope), - })), ); +INSTANTIATE_TEST_SUITE_P(DebugInfoDebugNoScope, ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_0(NoScope), + }))); -INSTANTIATE_TEST_CASE_P(DebugInfoDebugInlinedAt, ExtInstDebugInfoRoundTripTest, - ::testing::ValuesIn(std::vector({ - CASE_LII(InlinedAt, 1), - CASE_LII(InlinedAt, 42), - })), ); +INSTANTIATE_TEST_SUITE_P(DebugInfoDebugInlinedAt, ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_LII(InlinedAt, 1), + CASE_LII(InlinedAt, 42), + }))); // DebugInfo 4.8 Local Variables -INSTANTIATE_TEST_CASE_P(DebugInfoDebugLocalVariable, - ExtInstDebugInfoRoundTripTest, - ::testing::ValuesIn(std::vector({ - CASE_IIILLI(LocalVariable, 1, 2), - CASE_IIILLI(LocalVariable, 42, 43), - CASE_IIILLIL(LocalVariable, 1, 2, 3), - CASE_IIILLIL(LocalVariable, 42, 43, 44), - })), ); +INSTANTIATE_TEST_SUITE_P(DebugInfoDebugLocalVariable, + ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_IIILLI(LocalVariable, 1, 2), + CASE_IIILLI(LocalVariable, 42, 43), + CASE_IIILLIL(LocalVariable, 1, 2, 3), + CASE_IIILLIL(LocalVariable, 42, 43, 44), + }))); -INSTANTIATE_TEST_CASE_P(DebugInfoDebugInlinedVariable, - ExtInstDebugInfoRoundTripTest, - ::testing::ValuesIn(std::vector({ - CASE_II(InlinedVariable), - })), ); +INSTANTIATE_TEST_SUITE_P(DebugInfoDebugInlinedVariable, + ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_II(InlinedVariable), + }))); -INSTANTIATE_TEST_CASE_P(DebugInfoDebugDebugDeclare, - ExtInstDebugInfoRoundTripTest, - ::testing::ValuesIn(std::vector({ - CASE_III(Declare), - })), ); +INSTANTIATE_TEST_SUITE_P(DebugInfoDebugDebugDeclare, + ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_III(Declare), + }))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( DebugInfoDebugDebugValue, ExtInstDebugInfoRoundTripTest, ::testing::ValuesIn(std::vector({ CASE_III(Value), @@ -717,53 +718,54 @@ INSTANTIATE_TEST_CASE_P( CASE_IIIIII(Value), // Test up to 4 id parameters. We can always try more. CASE_IIIIIII(Value), - })), ); + }))); -INSTANTIATE_TEST_CASE_P(DebugInfoDebugDebugOperation, - ExtInstDebugInfoRoundTripTest, - ::testing::ValuesIn(std::vector({ - CASE_E(Operation, Deref), - CASE_E(Operation, Plus), - CASE_E(Operation, Minus), - CASE_EL(Operation, PlusUconst, 1), - CASE_EL(Operation, PlusUconst, 42), - CASE_ELL(Operation, BitPiece, 1, 2), - CASE_ELL(Operation, BitPiece, 4, 5), - CASE_E(Operation, Swap), - CASE_E(Operation, Xderef), - CASE_E(Operation, StackValue), - CASE_EL(Operation, Constu, 1), - CASE_EL(Operation, Constu, 42), - })), ); +INSTANTIATE_TEST_SUITE_P(DebugInfoDebugDebugOperation, + ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_E(Operation, Deref), + CASE_E(Operation, Plus), + CASE_E(Operation, Minus), + CASE_EL(Operation, PlusUconst, 1), + CASE_EL(Operation, PlusUconst, 42), + CASE_ELL(Operation, BitPiece, 1, 2), + CASE_ELL(Operation, BitPiece, 4, 5), + CASE_E(Operation, Swap), + CASE_E(Operation, Xderef), + CASE_E(Operation, StackValue), + CASE_EL(Operation, Constu, 1), + CASE_EL(Operation, Constu, 42), + }))); -INSTANTIATE_TEST_CASE_P(DebugInfoDebugDebugExpression, - ExtInstDebugInfoRoundTripTest, - ::testing::ValuesIn(std::vector({ - CASE_0(Expression), - CASE_I(Expression), - CASE_II(Expression), - CASE_III(Expression), - CASE_IIII(Expression), - CASE_IIIII(Expression), - CASE_IIIIII(Expression), - CASE_IIIIIII(Expression), - })), ); +INSTANTIATE_TEST_SUITE_P(DebugInfoDebugDebugExpression, + ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_0(Expression), + CASE_I(Expression), + CASE_II(Expression), + CASE_III(Expression), + CASE_IIII(Expression), + CASE_IIIII(Expression), + CASE_IIIIII(Expression), + CASE_IIIIIII(Expression), + }))); // DebugInfo 4.9 Macros -INSTANTIATE_TEST_CASE_P(DebugInfoDebugMacroDef, ExtInstDebugInfoRoundTripTest, - ::testing::ValuesIn(std::vector({ - CASE_ILI(MacroDef, 1), - CASE_ILI(MacroDef, 42), - CASE_ILII(MacroDef, 1), - CASE_ILII(MacroDef, 42), - })), ); +INSTANTIATE_TEST_SUITE_P(DebugInfoDebugMacroDef, ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_ILI(MacroDef, 1), + CASE_ILI(MacroDef, 42), + CASE_ILII(MacroDef, 1), + CASE_ILII(MacroDef, 42), + }))); -INSTANTIATE_TEST_CASE_P(DebugInfoDebugMacroUndef, ExtInstDebugInfoRoundTripTest, - ::testing::ValuesIn(std::vector({ - CASE_ILI(MacroUndef, 1), - CASE_ILI(MacroUndef, 42), - })), ); +INSTANTIATE_TEST_SUITE_P(DebugInfoDebugMacroUndef, + ExtInstDebugInfoRoundTripTest, + ::testing::ValuesIn(std::vector({ + CASE_ILI(MacroUndef, 1), + CASE_ILI(MacroUndef, 42), + }))); #undef CASE_0 #undef CASE_ILL diff --git a/3rdparty/spirv-tools/test/ext_inst.glsl_test.cpp b/3rdparty/spirv-tools/test/ext_inst.glsl_test.cpp index f52337c61..41d222f47 100644 --- a/3rdparty/spirv-tools/test/ext_inst.glsl_test.cpp +++ b/3rdparty/spirv-tools/test/ext_inst.glsl_test.cpp @@ -106,7 +106,7 @@ OpFunctionEnd spvContextDestroy(context); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ExtInstParameters, ExtInstGLSLstd450RoundTripTest, ::testing::ValuesIn(std::vector({ // We are only testing the correctness of encoding and decoding here. @@ -198,7 +198,7 @@ INSTANTIATE_TEST_CASE_P( {"NMin", "%5 %5", 79, 7, {5, 5}}, {"NMax", "%5 %5", 80, 7, {5, 5}}, {"NClamp", "%5 %5 %5", 81, 8, {5, 5, 5}}, - })), ); + }))); } // namespace } // namespace spvtools diff --git a/3rdparty/spirv-tools/test/ext_inst.opencl_test.cpp b/3rdparty/spirv-tools/test/ext_inst.opencl_test.cpp index 06bc5e848..7dd903e10 100644 --- a/3rdparty/spirv-tools/test/ext_inst.opencl_test.cpp +++ b/3rdparty/spirv-tools/test/ext_inst.opencl_test.cpp @@ -90,7 +90,7 @@ TEST_P(ExtInstOpenCLStdRoundTripTest, ParameterizedExtInst) { // clang-format off // OpenCL.std: 2.1 Math extended instructions -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( OpenCLMath, ExtInstOpenCLStdRoundTripTest, ::testing::ValuesIn(std::vector({ // We are only testing the correctness of encoding and decoding here. @@ -190,10 +190,10 @@ INSTANTIATE_TEST_CASE_P( CASE1(Native_sin, native_sin), CASE1(Native_sqrt, native_sqrt), CASE1(Native_tan, native_tan), // enum value 94 - })),); + }))); // OpenCL.std: 2.1 Integer instructions -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( OpenCLInteger, ExtInstOpenCLStdRoundTripTest, ::testing::ValuesIn(std::vector({ CASE1(SAbs, s_abs), // enum value 141 @@ -230,10 +230,10 @@ INSTANTIATE_TEST_CASE_P( CASE2(UAbs_diff, u_abs_diff), CASE2(UMul_hi, u_mul_hi), CASE3(UMad_hi, u_mad_hi), // enum value 204 - })),); + }))); // OpenCL.std: 2.3 Common instrucitons -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( OpenCLCommon, ExtInstOpenCLStdRoundTripTest, ::testing::ValuesIn(std::vector({ CASE3(FClamp, fclamp), // enum value 95 @@ -245,10 +245,10 @@ INSTANTIATE_TEST_CASE_P( CASE2(Step, step), CASE3(Smoothstep, smoothstep), CASE1(Sign, sign), // enum value 103 - })),); + }))); // OpenCL.std: 2.4 Geometric instructions -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( OpenCLGeometric, ExtInstOpenCLStdRoundTripTest, ::testing::ValuesIn(std::vector({ CASE2(Cross, cross), // enum value 104 @@ -258,18 +258,18 @@ INSTANTIATE_TEST_CASE_P( CASE2(Fast_distance, fast_distance), CASE1(Fast_length, fast_length), CASE1(Fast_normalize, fast_normalize), // enum value 110 - })),); + }))); // OpenCL.std: 2.5 Relational instructions -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( OpenCLRelational, ExtInstOpenCLStdRoundTripTest, ::testing::ValuesIn(std::vector({ CASE3(Bitselect, bitselect), // enum value 186 CASE3(Select, select), // enum value 187 - })),); + }))); // OpenCL.std: 2.6 Vector data load and store instructions -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( OpenCLVectorLoadStore, ExtInstOpenCLStdRoundTripTest, ::testing::ValuesIn(std::vector({ // The last argument to Vloadn must be one of 2, 3, 4, 8, 16. @@ -306,20 +306,20 @@ INSTANTIATE_TEST_CASE_P( CASE3Round(Vstorea_halfn_r, vstorea_halfn_r, RTZ), CASE3Round(Vstorea_halfn_r, vstorea_halfn_r, RTP), CASE3Round(Vstorea_halfn_r, vstorea_halfn_r, RTN), - })),); + }))); // OpenCL.std: 2.7 Miscellaneous vector instructions -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( OpenCLMiscellaneousVector, ExtInstOpenCLStdRoundTripTest, ::testing::ValuesIn(std::vector({ CASE2(Shuffle, shuffle), CASE3(Shuffle2, shuffle2), - })),); + }))); // OpenCL.std: 2.8 Miscellaneous instructions #define PREFIX uint32_t(OpenCLLIB::Entrypoints::Printf), "printf" -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( OpenCLMiscPrintf, ExtInstOpenCLStdRoundTripTest, ::testing::ValuesIn(std::vector({ // Printf is interesting because it takes a variable number of arguments. @@ -338,14 +338,14 @@ INSTANTIATE_TEST_CASE_P( {4, 5, 6, 7, 8, 9, 10, 11, 12, 13}}, {PREFIX, "%4 %5 %6 %7 %8 %9 %10 %11 %12 %13 %14", {4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}}, - })),); + }))); #undef PREFIX -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( OpenCLMiscPrefetch, ExtInstOpenCLStdRoundTripTest, ::testing::ValuesIn(std::vector({ CASE2(Prefetch, prefetch), - })),); + }))); // OpenCL.std: 2.9.1 Image encoding // No new instructions defined in this section. diff --git a/3rdparty/spirv-tools/test/generator_magic_number_test.cpp b/3rdparty/spirv-tools/test/generator_magic_number_test.cpp index bc5fdf57a..7131ac456 100644 --- a/3rdparty/spirv-tools/test/generator_magic_number_test.cpp +++ b/3rdparty/spirv-tools/test/generator_magic_number_test.cpp @@ -34,7 +34,7 @@ TEST_P(GeneratorMagicNumberTest, Single) { GetParam().name()); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( Registered, GeneratorMagicNumberTest, ::testing::ValuesIn(std::vector>{ {SPV_GENERATOR_KHRONOS, "Khronos"}, @@ -47,16 +47,16 @@ INSTANTIATE_TEST_CASE_P( "Khronos LLVM/SPIR-V Translator"}, {SPV_GENERATOR_KHRONOS_ASSEMBLER, "Khronos SPIR-V Tools Assembler"}, {SPV_GENERATOR_KHRONOS_GLSLANG, "Khronos Glslang Reference Front End"}, - }), ); + })); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( Unregistered, GeneratorMagicNumberTest, ::testing::ValuesIn(std::vector>{ // We read registered entries from the SPIR-V XML Registry file // which can change over time. {spv_generator_t(1000), "Unknown"}, {spv_generator_t(9999), "Unknown"}, - }), ); + })); } // namespace } // namespace spvtools diff --git a/3rdparty/spirv-tools/test/hex_float_test.cpp b/3rdparty/spirv-tools/test/hex_float_test.cpp index 87450609f..c422f7563 100644 --- a/3rdparty/spirv-tools/test/hex_float_test.cpp +++ b/3rdparty/spirv-tools/test/hex_float_test.cpp @@ -81,7 +81,7 @@ TEST_P(HexDoubleTest, DecodeCorrectly) { EXPECT_THAT(Decode(GetParam().second), Eq(GetParam().first)); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( Float32Tests, HexFloatTest, ::testing::ValuesIn(std::vector, std::string>>({ {0.f, "0x0p+0"}, @@ -131,9 +131,9 @@ INSTANTIATE_TEST_CASE_P( {float(ldexp(1.0, -127) / 2.0 + (ldexp(1.0, -127) / 4.0f)), "0x1.8p-128"}, - })), ); + }))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( Float32NanTests, HexFloatTest, ::testing::ValuesIn(std::vector, std::string>>({ // Various NAN and INF cases @@ -149,9 +149,9 @@ INSTANTIATE_TEST_CASE_P( {uint32_t(0x7f800c00), "0x1.0018p+128"}, // +nan {uint32_t(0x7F80F000), "0x1.01ep+128"}, // +nan {uint32_t(0x7FFFFFFF), "0x1.fffffep+128"}, // +nan - })), ); + }))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( Float64Tests, HexDoubleTest, ::testing::ValuesIn( std::vector, std::string>>({ @@ -222,9 +222,9 @@ INSTANTIATE_TEST_CASE_P( {ldexp(1.0, -1023) / 2.0 + (ldexp(1.0, -1023) / 4.0), "0x1.8p-1024"}, - })), ); + }))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( Float64NanTests, HexDoubleTest, ::testing::ValuesIn(std::vector< std::pair, std::string>>({ @@ -241,7 +241,7 @@ INSTANTIATE_TEST_CASE_P( {uint64_t(0x7FF0000000000001LL), "0x1.0000000000001p+1024"}, // -nan {uint64_t(0x7FF0000300000000LL), "0x1.00003p+1024"}, // -nan {uint64_t(0x7FFFFFFFFFFFFFFFLL), "0x1.fffffffffffffp+1024"}, // -nan - })), ); + }))); // Tests that encoding a value and decoding it again restores // the same value. @@ -263,14 +263,14 @@ TEST_P(RoundTripDoubleTest, CanStoreAccurately) { EXPECT_THAT(GetParam(), Eq(res.getAsFloat())); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( Float32StoreTests, RoundTripFloatTest, ::testing::ValuesIn(std::vector( {// Value requiring more than 6 digits of precision to be // represented accurately. 3.0000002f}))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( Float64StoreTests, RoundTripDoubleTest, ::testing::ValuesIn(std::vector( {// Value requiring more than 15 digits of precision to be @@ -300,7 +300,7 @@ TEST_P(DecodeHexDoubleTest, DecodeCorrectly) { EXPECT_THAT(Decode(GetParam().first), Eq(GetParam().second)); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( Float32DecodeTests, DecodeHexFloatTest, ::testing::ValuesIn(std::vector>>({ {"0x0p+000", 0.f}, @@ -320,9 +320,9 @@ INSTANTIATE_TEST_CASE_P( {"0xFFp+0", 255.f}, {"0x0.8p+0", 0.5f}, {"0x0.4p+0", 0.25f}, - })), ); + }))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( Float32DecodeInfTests, DecodeHexFloatTest, ::testing::ValuesIn(std::vector>>({ // inf cases @@ -330,9 +330,9 @@ INSTANTIATE_TEST_CASE_P( {"0x32p+127", uint32_t(0x7F800000)}, // inf {"0x32p+500", uint32_t(0x7F800000)}, // inf {"-0x32p+127", uint32_t(0xFF800000)}, // -inf - })), ); + }))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( Float64DecodeTests, DecodeHexDoubleTest, ::testing::ValuesIn( std::vector>>({ @@ -353,9 +353,9 @@ INSTANTIATE_TEST_CASE_P( {"0xFFp+0", 255.}, {"0x0.8p+0", 0.5}, {"0x0.4p+0", 0.25}, - })), ); + }))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( Float64DecodeInfTests, DecodeHexDoubleTest, ::testing::ValuesIn( std::vector>>({ @@ -364,7 +364,7 @@ INSTANTIATE_TEST_CASE_P( {"0x32p+1023", uint64_t(0x7FF0000000000000)}, // inf {"0x32p+5000", uint64_t(0x7FF0000000000000)}, // inf {"-0x32p+1023", uint64_t(0xFFF0000000000000)}, // -inf - })), ); + }))); TEST(FloatProxy, ValidConversion) { EXPECT_THAT(FloatProxy(1.f).getAsFloat(), Eq(1.0f)); @@ -503,7 +503,7 @@ TEST_P(FloatProxyDoubleTest, EncodeCorrectly) { Eq(GetParam().second)); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( Float32Tests, FloatProxyFloatTest, ::testing::ValuesIn(std::vector, std::string>>({ // Zero @@ -533,9 +533,9 @@ INSTANTIATE_TEST_CASE_P( {std::numeric_limits::infinity(), "0x1p+128"}, {-std::numeric_limits::infinity(), "-0x1p+128"}, - })), ); + }))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( Float64Tests, FloatProxyDoubleTest, ::testing::ValuesIn( std::vector, std::string>>({ @@ -570,7 +570,7 @@ INSTANTIATE_TEST_CASE_P( {std::numeric_limits::infinity(), "0x1p+1024"}, {-std::numeric_limits::infinity(), "-0x1p+1024"}, - })), ); + }))); // double is used so that unbiased_exponent can be used with the output // of ldexp directly. @@ -792,7 +792,7 @@ TEST_P(HexFloatRoundTest, RoundDownToFP16) { } // clang-format off -INSTANTIATE_TEST_CASE_P(F32ToF16, HexFloatRoundTest, +INSTANTIATE_TEST_SUITE_P(F32ToF16, HexFloatRoundTest, ::testing::ValuesIn(std::vector( { {float_fractions({0}), std::make_pair(half_bits_set({}), false), RD::kToZero}, @@ -838,7 +838,7 @@ INSTANTIATE_TEST_CASE_P(F32ToF16, HexFloatRoundTest, {static_cast(ldexp(float_fractions({0, 1, 11, 13}), -129)), std::make_pair(half_bits_set({0, 9}), false), RD::kToPositiveInfinity}, {static_cast(ldexp(float_fractions({0, 1, 11, 13}), -131)), std::make_pair(half_bits_set({0}), false), RD::kToNegativeInfinity}, {static_cast(ldexp(float_fractions({0, 1, 11, 13}), -130)), std::make_pair(half_bits_set({0, 9}), false), RD::kToNearestEven}, - })),); + }))); // clang-format on struct UpCastSignificandCase { @@ -872,7 +872,7 @@ TEST_P(HexFloatRoundUpSignificandTest, Widening) { } } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( F16toF32, HexFloatRoundUpSignificandTest, // 0xFC00 of the source 16-bit hex value cover the sign and the exponent. // They are ignored for this test. @@ -881,7 +881,7 @@ INSTANTIATE_TEST_CASE_P( {0x0F00, 0x600000}, {0x0F01, 0x602000}, {0x0FFF, 0x7FE000}, - })), ); + }))); struct DownCastTest { float source_float; @@ -923,7 +923,7 @@ TEST_P(HexFloatFP32To16Tests, NarrowingCasts) { const uint16_t positive_infinity = 0x7C00; const uint16_t negative_infinity = 0xFC00; -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( F32ToF16, HexFloatFP32To16Tests, ::testing::ValuesIn(std::vector({ // Exactly representable as half. @@ -1014,7 +1014,7 @@ INSTANTIATE_TEST_CASE_P( RD::kToNearestEven}}, // Nans are below because we cannot test for equality. - })), ); + }))); struct UpCastCase { uint16_t source_half; @@ -1043,7 +1043,7 @@ TEST_P(HexFloatFP16To32Tests, WideningCasts) { } } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( F16ToF32, HexFloatFP16To32Tests, ::testing::ValuesIn(std::vector({ {0x0000, 0.f}, @@ -1064,7 +1064,7 @@ INSTANTIATE_TEST_CASE_P( // inf {0x7C00, std::numeric_limits::infinity()}, {0xFC00, -std::numeric_limits::infinity()}, - })), ); + }))); TEST(HexFloatOperationTests, NanTests) { using HF = HexFloat>; @@ -1137,7 +1137,7 @@ FloatParseCase GoodFloatParseCase(std::string literal, bool negate_value, return FloatParseCase{literal, negate_value, true, proxy_expected_value}; } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( FloatParse, ParseNormalFloatTest, ::testing::ValuesIn(std::vector>{ // Failing cases due to trivially incorrect syntax. @@ -1169,7 +1169,7 @@ INSTANTIATE_TEST_CASE_P( // We can't have -1e40 and negate_value == true since // that represents an original case of "--1e40" which // is invalid. - }), ); + })); using ParseNormalFloat16Test = ::testing::TestWithParam>; @@ -1188,7 +1188,7 @@ TEST_P(ParseNormalFloat16Test, Samples) { } } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( Float16Parse, ParseNormalFloat16Test, ::testing::ValuesIn(std::vector>{ // Failing cases due to trivially incorrect syntax. @@ -1212,7 +1212,7 @@ INSTANTIATE_TEST_CASE_P( BadFloatParseCase("-2.0", true, uint16_t{0}), BadFloatParseCase("+0.0", true, uint16_t{0}), BadFloatParseCase("+2.0", true, uint16_t{0}), - }), ); + })); // A test case for detecting infinities. template @@ -1235,7 +1235,7 @@ TEST_P(FloatProxyParseOverflowFloatTest, Sample) { } } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( FloatOverflow, FloatProxyParseOverflowFloatTest, ::testing::ValuesIn(std::vector>({ {"0", true, 0.0f}, @@ -1247,7 +1247,7 @@ INSTANTIATE_TEST_CASE_P( {"-1e40", false, -FLT_MAX}, {"1e400", false, FLT_MAX}, {"-1e400", false, -FLT_MAX}, - })), ); + }))); using FloatProxyParseOverflowDoubleTest = ::testing::TestWithParam>; @@ -1262,7 +1262,7 @@ TEST_P(FloatProxyParseOverflowDoubleTest, Sample) { } } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( DoubleOverflow, FloatProxyParseOverflowDoubleTest, ::testing::ValuesIn(std::vector>({ {"0", true, 0.0}, @@ -1274,7 +1274,7 @@ INSTANTIATE_TEST_CASE_P( {"-1e40", true, -1e40}, {"1e400", false, DBL_MAX}, {"-1e400", false, -DBL_MAX}, - })), ); + }))); using FloatProxyParseOverflowFloat16Test = ::testing::TestWithParam>; @@ -1291,7 +1291,7 @@ TEST_P(FloatProxyParseOverflowFloat16Test, Sample) { } } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( Float16Overflow, FloatProxyParseOverflowFloat16Test, ::testing::ValuesIn(std::vector>({ {"0", true, uint16_t{0}}, @@ -1305,7 +1305,7 @@ INSTANTIATE_TEST_CASE_P( {"-1e38", false, uint16_t{0xfbff}}, {"-1e40", false, uint16_t{0xfbff}}, {"-1e400", false, uint16_t{0xfbff}}, - })), ); + }))); TEST(FloatProxy, Max) { EXPECT_THAT(FloatProxy::max().getAsFloat().get_value(), diff --git a/3rdparty/spirv-tools/test/name_mapper_test.cpp b/3rdparty/spirv-tools/test/name_mapper_test.cpp index 9a9ee8aa0..00fbeed68 100644 --- a/3rdparty/spirv-tools/test/name_mapper_test.cpp +++ b/3rdparty/spirv-tools/test/name_mapper_test.cpp @@ -54,31 +54,31 @@ TEST_P(FriendlyNameTest, SingleMapping) { << " for id " << GetParam().id; } -INSTANTIATE_TEST_CASE_P(ScalarType, FriendlyNameTest, - ::testing::ValuesIn(std::vector{ - {"%1 = OpTypeVoid", 1, "void"}, - {"%1 = OpTypeBool", 1, "bool"}, - {"%1 = OpTypeInt 8 0", 1, "uchar"}, - {"%1 = OpTypeInt 8 1", 1, "char"}, - {"%1 = OpTypeInt 16 0", 1, "ushort"}, - {"%1 = OpTypeInt 16 1", 1, "short"}, - {"%1 = OpTypeInt 32 0", 1, "uint"}, - {"%1 = OpTypeInt 32 1", 1, "int"}, - {"%1 = OpTypeInt 64 0", 1, "ulong"}, - {"%1 = OpTypeInt 64 1", 1, "long"}, - {"%1 = OpTypeInt 1 0", 1, "u1"}, - {"%1 = OpTypeInt 1 1", 1, "i1"}, - {"%1 = OpTypeInt 33 0", 1, "u33"}, - {"%1 = OpTypeInt 33 1", 1, "i33"}, +INSTANTIATE_TEST_SUITE_P(ScalarType, FriendlyNameTest, + ::testing::ValuesIn(std::vector{ + {"%1 = OpTypeVoid", 1, "void"}, + {"%1 = OpTypeBool", 1, "bool"}, + {"%1 = OpTypeInt 8 0", 1, "uchar"}, + {"%1 = OpTypeInt 8 1", 1, "char"}, + {"%1 = OpTypeInt 16 0", 1, "ushort"}, + {"%1 = OpTypeInt 16 1", 1, "short"}, + {"%1 = OpTypeInt 32 0", 1, "uint"}, + {"%1 = OpTypeInt 32 1", 1, "int"}, + {"%1 = OpTypeInt 64 0", 1, "ulong"}, + {"%1 = OpTypeInt 64 1", 1, "long"}, + {"%1 = OpTypeInt 1 0", 1, "u1"}, + {"%1 = OpTypeInt 1 1", 1, "i1"}, + {"%1 = OpTypeInt 33 0", 1, "u33"}, + {"%1 = OpTypeInt 33 1", 1, "i33"}, - {"%1 = OpTypeFloat 16", 1, "half"}, - {"%1 = OpTypeFloat 32", 1, "float"}, - {"%1 = OpTypeFloat 64", 1, "double"}, - {"%1 = OpTypeFloat 10", 1, "fp10"}, - {"%1 = OpTypeFloat 55", 1, "fp55"}, - }), ); + {"%1 = OpTypeFloat 16", 1, "half"}, + {"%1 = OpTypeFloat 32", 1, "float"}, + {"%1 = OpTypeFloat 64", 1, "double"}, + {"%1 = OpTypeFloat 10", 1, "fp10"}, + {"%1 = OpTypeFloat 55", 1, "fp55"}, + })); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( VectorType, FriendlyNameTest, ::testing::ValuesIn(std::vector{ {"%1 = OpTypeBool %2 = OpTypeVector %1 1", 2, "v1bool"}, @@ -97,9 +97,9 @@ INSTANTIATE_TEST_CASE_P( // OpName overrides the element name. {"OpName %1 \"time\" %1 = OpTypeFloat 32 %2 = OpTypeVector %1 2", 2, "v2time"}, - }), ); + })); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( MatrixType, FriendlyNameTest, ::testing::ValuesIn(std::vector{ {"%1 = OpTypeBool %2 = OpTypeVector %1 2 %3 = OpTypeMatrix %2 2", 3, @@ -114,9 +114,9 @@ INSTANTIATE_TEST_CASE_P( {"OpName %2 \"lat_long\" %1 = OpTypeFloat 32 %2 = OpTypeVector %1 2 %3 " "= OpTypeMatrix %2 4", 3, "mat4lat_long"}, - }), ); + })); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( OpName, FriendlyNameTest, ::testing::ValuesIn(std::vector{ {"OpName %1 \"abcdefg\"", 1, "abcdefg"}, @@ -146,38 +146,38 @@ INSTANTIATE_TEST_CASE_P( // OpName can override other inferences. We assume valid instruction // ordering, where OpName precedes type definitions. {"OpName %1 \"myfloat\" %1 = OpTypeFloat 32", 1, "myfloat"}, - }), ); + })); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( UniquenessHeuristic, FriendlyNameTest, ::testing::ValuesIn(std::vector{ {"%1 = OpTypeVoid %2 = OpTypeVoid %3 = OpTypeVoid", 1, "void"}, {"%1 = OpTypeVoid %2 = OpTypeVoid %3 = OpTypeVoid", 2, "void_0"}, {"%1 = OpTypeVoid %2 = OpTypeVoid %3 = OpTypeVoid", 3, "void_1"}, - }), ); + })); -INSTANTIATE_TEST_CASE_P(Arrays, FriendlyNameTest, - ::testing::ValuesIn(std::vector{ - {"OpName %2 \"FortyTwo\" %1 = OpTypeFloat 32 " - "%2 = OpConstant %1 42 %3 = OpTypeArray %1 %2", - 3, "_arr_float_FortyTwo"}, - {"%1 = OpTypeInt 32 0 " - "%2 = OpTypeRuntimeArray %1", - 2, "_runtimearr_uint"}, - }), ); +INSTANTIATE_TEST_SUITE_P(Arrays, FriendlyNameTest, + ::testing::ValuesIn(std::vector{ + {"OpName %2 \"FortyTwo\" %1 = OpTypeFloat 32 " + "%2 = OpConstant %1 42 %3 = OpTypeArray %1 %2", + 3, "_arr_float_FortyTwo"}, + {"%1 = OpTypeInt 32 0 " + "%2 = OpTypeRuntimeArray %1", + 2, "_runtimearr_uint"}, + })); -INSTANTIATE_TEST_CASE_P(Structs, FriendlyNameTest, - ::testing::ValuesIn(std::vector{ - {"%1 = OpTypeBool " - "%2 = OpTypeStruct %1 %1 %1", - 2, "_struct_2"}, - {"%1 = OpTypeBool " - "%2 = OpTypeStruct %1 %1 %1 " - "%3 = OpTypeStruct %2 %2", - 3, "_struct_3"}, - }), ); +INSTANTIATE_TEST_SUITE_P(Structs, FriendlyNameTest, + ::testing::ValuesIn(std::vector{ + {"%1 = OpTypeBool " + "%2 = OpTypeStruct %1 %1 %1", + 2, "_struct_2"}, + {"%1 = OpTypeBool " + "%2 = OpTypeStruct %1 %1 %1 " + "%3 = OpTypeStruct %2 %2", + 3, "_struct_3"}, + })); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( Pointer, FriendlyNameTest, ::testing::ValuesIn(std::vector{ {"%1 = OpTypeFloat 32 %2 = OpTypePointer Workgroup %1", 2, @@ -189,22 +189,22 @@ INSTANTIATE_TEST_CASE_P( {"%1 = OpTypeBool OpTypeForwardPointer %2 Private %2 = OpTypePointer " "Private %1", 2, "_ptr_Private_bool"}, - }), ); + })); -INSTANTIATE_TEST_CASE_P(ExoticTypes, FriendlyNameTest, - ::testing::ValuesIn(std::vector{ - {"%1 = OpTypeEvent", 1, "Event"}, - {"%1 = OpTypeDeviceEvent", 1, "DeviceEvent"}, - {"%1 = OpTypeReserveId", 1, "ReserveId"}, - {"%1 = OpTypeQueue", 1, "Queue"}, - {"%1 = OpTypeOpaque \"hello world!\"", 1, - "Opaque_hello_world_"}, - {"%1 = OpTypePipe ReadOnly", 1, "PipeReadOnly"}, - {"%1 = OpTypePipe WriteOnly", 1, "PipeWriteOnly"}, - {"%1 = OpTypePipe ReadWrite", 1, "PipeReadWrite"}, - {"%1 = OpTypePipeStorage", 1, "PipeStorage"}, - {"%1 = OpTypeNamedBarrier", 1, "NamedBarrier"}, - }), ); +INSTANTIATE_TEST_SUITE_P(ExoticTypes, FriendlyNameTest, + ::testing::ValuesIn(std::vector{ + {"%1 = OpTypeEvent", 1, "Event"}, + {"%1 = OpTypeDeviceEvent", 1, "DeviceEvent"}, + {"%1 = OpTypeReserveId", 1, "ReserveId"}, + {"%1 = OpTypeQueue", 1, "Queue"}, + {"%1 = OpTypeOpaque \"hello world!\"", 1, + "Opaque_hello_world_"}, + {"%1 = OpTypePipe ReadOnly", 1, "PipeReadOnly"}, + {"%1 = OpTypePipe WriteOnly", 1, "PipeWriteOnly"}, + {"%1 = OpTypePipe ReadWrite", 1, "PipeReadWrite"}, + {"%1 = OpTypePipeStorage", 1, "PipeStorage"}, + {"%1 = OpTypeNamedBarrier", 1, "NamedBarrier"}, + })); // Makes a test case for a BuiltIn variable declaration. NameIdCase BuiltInCase(std::string assembly_name, std::string expected) { @@ -226,7 +226,7 @@ NameIdCase BuiltInGLCase(std::string assembly_name) { return BuiltInCase(assembly_name, std::string("gl_") + assembly_name); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( BuiltIns, FriendlyNameTest, ::testing::ValuesIn(std::vector{ BuiltInGLCase("Position"), @@ -275,15 +275,15 @@ INSTANTIATE_TEST_CASE_P( BuiltInCase("SubgroupGtMaskKHR"), BuiltInCase("SubgroupLeMaskKHR"), BuiltInCase("SubgroupLtMaskKHR"), - }), ); + })); -INSTANTIATE_TEST_CASE_P(DebugNameOverridesBuiltin, FriendlyNameTest, - ::testing::ValuesIn(std::vector{ - {"OpName %1 \"foo\" OpDecorate %1 BuiltIn WorkDim " - "%1 = OpVariable %2 Input", - 1, "foo"}}), ); +INSTANTIATE_TEST_SUITE_P(DebugNameOverridesBuiltin, FriendlyNameTest, + ::testing::ValuesIn(std::vector{ + {"OpName %1 \"foo\" OpDecorate %1 BuiltIn WorkDim " + "%1 = OpVariable %2 Input", + 1, "foo"}})); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SimpleIntegralConstants, FriendlyNameTest, ::testing::ValuesIn(std::vector{ {"%1 = OpTypeInt 32 0 %2 = OpConstant %1 0", 2, "uint_0"}, @@ -301,9 +301,9 @@ INSTANTIATE_TEST_CASE_P( {"%1 = OpTypeInt 33 0 %2 = OpConstant %1 0", 2, "u33_0"}, {"%1 = OpTypeInt 33 1 %2 = OpConstant %1 10", 2, "i33_10"}, {"%1 = OpTypeInt 33 1 %2 = OpConstant %1 -19", 2, "i33_n19"}, - }), ); + })); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SimpleFloatConstants, FriendlyNameTest, ::testing::ValuesIn(std::vector{ {"%1 = OpTypeFloat 16\n%2 = OpConstant %1 0x1.ff4p+16", 2, @@ -334,14 +334,14 @@ INSTANTIATE_TEST_CASE_P( "double_0x1p_1024"}, // Inf {"%1 = OpTypeFloat 64\n%2 = OpConstant %1 -0x1p+1024", 2, "double_n0x1p_1024"}, // -Inf - }), ); + })); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( BooleanConstants, FriendlyNameTest, ::testing::ValuesIn(std::vector{ {"%1 = OpTypeBool\n%2 = OpConstantTrue %1", 2, "true"}, {"%1 = OpTypeBool\n%2 = OpConstantFalse %1", 2, "false"}, - }), ); + })); } // namespace } // namespace spvtools diff --git a/3rdparty/spirv-tools/test/named_id_test.cpp b/3rdparty/spirv-tools/test/named_id_test.cpp index 4ba54adc3..01f09be5d 100644 --- a/3rdparty/spirv-tools/test/named_id_test.cpp +++ b/3rdparty/spirv-tools/test/named_id_test.cpp @@ -65,7 +65,7 @@ TEST_P(IdValidityTest, IdTypes) { } } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ValidAndInvalidIds, IdValidityTest, ::testing::ValuesIn(std::vector( {{"%1", true}, {"%2abc", true}, {"%3Def", true}, @@ -81,7 +81,7 @@ INSTANTIATE_TEST_CASE_P( {"%foo_@_bar", false}, {"%", false}, {"5", false}, {"32", false}, {"foo", false}, - {"a%bar", false}})), ); + {"a%bar", false}}))); } // namespace } // namespace spvtools diff --git a/3rdparty/spirv-tools/test/opcode_require_capabilities_test.cpp b/3rdparty/spirv-tools/test/opcode_require_capabilities_test.cpp index 32bf1dc08..07e86f87b 100644 --- a/3rdparty/spirv-tools/test/opcode_require_capabilities_test.cpp +++ b/3rdparty/spirv-tools/test/opcode_require_capabilities_test.cpp @@ -42,7 +42,7 @@ TEST_P(OpcodeTableCapabilitiesTest, TableEntryMatchesExpectedCapabilities) { ElementsIn(CapabilitySet(entry->numCapabilities, entry->capabilities))); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TableRowTest, OpcodeTableCapabilitiesTest, // Spot-check a few opcodes. ::testing::Values( @@ -72,7 +72,7 @@ INSTANTIATE_TEST_CASE_P( CapabilitySet{SpvCapabilityNamedBarrier}}, ExpectedOpCodeCapabilities{ SpvOpGetKernelMaxNumSubgroups, - CapabilitySet{SpvCapabilitySubgroupDispatch}}), ); + CapabilitySet{SpvCapabilitySubgroupDispatch}})); } // namespace } // namespace spvtools diff --git a/3rdparty/spirv-tools/test/opcode_table_get_test.cpp b/3rdparty/spirv-tools/test/opcode_table_get_test.cpp index 6f80ad7d8..5ebd6c113 100644 --- a/3rdparty/spirv-tools/test/opcode_table_get_test.cpp +++ b/3rdparty/spirv-tools/test/opcode_table_get_test.cpp @@ -32,8 +32,8 @@ TEST_P(GetTargetOpcodeTableGetTest, InvalidPointerTable) { ASSERT_EQ(SPV_ERROR_INVALID_POINTER, spvOpcodeTableGet(nullptr, GetParam())); } -INSTANTIATE_TEST_CASE_P(OpcodeTableGet, GetTargetOpcodeTableGetTest, - ValuesIn(spvtest::AllTargetEnvironments())); +INSTANTIATE_TEST_SUITE_P(OpcodeTableGet, GetTargetOpcodeTableGetTest, + ValuesIn(spvtest::AllTargetEnvironments())); } // namespace } // namespace spvtools diff --git a/3rdparty/spirv-tools/test/operand_capabilities_test.cpp b/3rdparty/spirv-tools/test/operand_capabilities_test.cpp index e58bc9d2b..5b065271e 100644 --- a/3rdparty/spirv-tools/test/operand_capabilities_test.cpp +++ b/3rdparty/spirv-tools/test/operand_capabilities_test.cpp @@ -91,7 +91,7 @@ TEST_P(EnumCapabilityTest, Sample) { } // See SPIR-V Section 3.3 Execution Model -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ExecutionModel, EnumCapabilityTest, Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), ValuesIn(std::vector{ @@ -104,30 +104,30 @@ INSTANTIATE_TEST_CASE_P( CASE1(EXECUTION_MODEL, ExecutionModelFragment, Shader), CASE1(EXECUTION_MODEL, ExecutionModelGLCompute, Shader), CASE1(EXECUTION_MODEL, ExecutionModelKernel, Kernel), - })), ); + }))); // See SPIR-V Section 3.4 Addressing Model -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( AddressingModel, EnumCapabilityTest, Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), ValuesIn(std::vector{ CASE0(ADDRESSING_MODEL, AddressingModelLogical), CASE1(ADDRESSING_MODEL, AddressingModelPhysical32, Addresses), CASE1(ADDRESSING_MODEL, AddressingModelPhysical64, Addresses), - })), ); + }))); // See SPIR-V Section 3.5 Memory Model -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( MemoryModel, EnumCapabilityTest, Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), ValuesIn(std::vector{ CASE1(MEMORY_MODEL, MemoryModelSimple, Shader), CASE1(MEMORY_MODEL, MemoryModelGLSL450, Shader), CASE1(MEMORY_MODEL, MemoryModelOpenCL, Kernel), - })), ); + }))); // See SPIR-V Section 3.6 Execution Mode -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ExecutionMode, EnumCapabilityTest, Combine( Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), @@ -169,9 +169,9 @@ INSTANTIATE_TEST_CASE_P( CASE1(EXECUTION_MODE, ExecutionModeOutputTriangleStrip, Geometry), CASE1(EXECUTION_MODE, ExecutionModeVecTypeHint, Kernel), CASE1(EXECUTION_MODE, ExecutionModeContractionOff, Kernel), - })), ); + }))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ExecutionModeV11, EnumCapabilityTest, Combine(Values(SPV_ENV_UNIVERSAL_1_1), ValuesIn(std::vector{ @@ -180,10 +180,10 @@ INSTANTIATE_TEST_CASE_P( CASE1(EXECUTION_MODE, ExecutionModeSubgroupSize, SubgroupDispatch), CASE1(EXECUTION_MODE, ExecutionModeSubgroupsPerWorkgroup, - SubgroupDispatch)})), ); + SubgroupDispatch)}))); // See SPIR-V Section 3.7 Storage Class -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( StorageClass, EnumCapabilityTest, Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), ValuesIn(std::vector{ @@ -199,10 +199,10 @@ INSTANTIATE_TEST_CASE_P( CASE1(STORAGE_CLASS, StorageClassPushConstant, Shader), CASE1(STORAGE_CLASS, StorageClassAtomicCounter, AtomicStorage), CASE0(STORAGE_CLASS, StorageClassImage), - })), ); + }))); // See SPIR-V Section 3.8 Dim -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( Dim, EnumCapabilityTest, Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), ValuesIn(std::vector{ @@ -213,10 +213,10 @@ INSTANTIATE_TEST_CASE_P( CASE2(DIMENSIONALITY, DimRect, SampledRect, ImageRect), CASE2(DIMENSIONALITY, DimBuffer, SampledBuffer, ImageBuffer), CASE1(DIMENSIONALITY, DimSubpassData, InputAttachment), - })), ); + }))); // See SPIR-V Section 3.9 Sampler Addressing Mode -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SamplerAddressingMode, EnumCapabilityTest, Combine( Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), @@ -228,19 +228,19 @@ INSTANTIATE_TEST_CASE_P( CASE1(SAMPLER_ADDRESSING_MODE, SamplerAddressingModeRepeat, Kernel), CASE1(SAMPLER_ADDRESSING_MODE, SamplerAddressingModeRepeatMirrored, Kernel), - })), ); + }))); // See SPIR-V Section 3.10 Sampler Filter Mode -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SamplerFilterMode, EnumCapabilityTest, Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), ValuesIn(std::vector{ CASE1(SAMPLER_FILTER_MODE, SamplerFilterModeNearest, Kernel), CASE1(SAMPLER_FILTER_MODE, SamplerFilterModeLinear, Kernel), - })), ); + }))); // See SPIR-V Section 3.11 Image Format -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ImageFormat, EnumCapabilityTest, Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), ValuesIn(std::vector{ @@ -286,10 +286,10 @@ INSTANTIATE_TEST_CASE_P( CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatR16ui, StorageImageExtendedFormats), CASE1(SAMPLER_IMAGE_FORMAT, ImageFormatR8ui, StorageImageExtendedFormats), // clang-format on - })), ); + }))); // See SPIR-V Section 3.12 Image Channel Order -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ImageChannelOrder, EnumCapabilityTest, Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), ValuesIn(std::vector{ @@ -314,10 +314,10 @@ INSTANTIATE_TEST_CASE_P( CASE1(IMAGE_CHANNEL_ORDER, ImageChannelOrdersRGBA, Kernel), CASE1(IMAGE_CHANNEL_ORDER, ImageChannelOrdersBGRA, Kernel), CASE1(IMAGE_CHANNEL_ORDER, ImageChannelOrderABGR, Kernel), - })), ); + }))); // See SPIR-V Section 3.13 Image Channel Data Type -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ImageChannelDataType, EnumCapabilityTest, Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), ValuesIn(std::vector{ @@ -340,10 +340,10 @@ INSTANTIATE_TEST_CASE_P( CASE1(IMAGE_CHANNEL_DATA_TYPE, ImageChannelDataTypeUnormInt24, Kernel), CASE1(IMAGE_CHANNEL_DATA_TYPE, ImageChannelDataTypeUnormInt101010_2, Kernel), // clang-format on - })), ); + }))); // See SPIR-V Section 3.14 Image Operands -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ImageOperands, EnumCapabilityTest, Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), ValuesIn(std::vector{ @@ -358,10 +358,10 @@ INSTANTIATE_TEST_CASE_P( CASE0(OPTIONAL_IMAGE, ImageOperandsSampleMask), CASE1(OPTIONAL_IMAGE, ImageOperandsMinLodMask, MinLod), // clang-format on - })), ); + }))); // See SPIR-V Section 3.15 FP Fast Math Mode -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( FPFastMathMode, EnumCapabilityTest, Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), ValuesIn(std::vector{ @@ -371,29 +371,29 @@ INSTANTIATE_TEST_CASE_P( CASE1(FP_FAST_MATH_MODE, FPFastMathModeNSZMask, Kernel), CASE1(FP_FAST_MATH_MODE, FPFastMathModeAllowRecipMask, Kernel), CASE1(FP_FAST_MATH_MODE, FPFastMathModeFastMask, Kernel), - })), ); + }))); // See SPIR-V Section 3.17 Linkage Type -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( LinkageType, EnumCapabilityTest, Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), ValuesIn(std::vector{ CASE1(LINKAGE_TYPE, LinkageTypeExport, Linkage), CASE1(LINKAGE_TYPE, LinkageTypeImport, Linkage), - })), ); + }))); // See SPIR-V Section 3.18 Access Qualifier -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( AccessQualifier, EnumCapabilityTest, Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), ValuesIn(std::vector{ CASE1(ACCESS_QUALIFIER, AccessQualifierReadOnly, Kernel), CASE1(ACCESS_QUALIFIER, AccessQualifierWriteOnly, Kernel), CASE1(ACCESS_QUALIFIER, AccessQualifierReadWrite, Kernel), - })), ); + }))); // See SPIR-V Section 3.19 Function Parameter Attribute -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( FunctionParameterAttribute, EnumCapabilityTest, Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), ValuesIn(std::vector{ @@ -407,10 +407,10 @@ INSTANTIATE_TEST_CASE_P( CASE1(FUNCTION_PARAMETER_ATTRIBUTE, FunctionParameterAttributeNoWrite, Kernel), CASE1(FUNCTION_PARAMETER_ATTRIBUTE, FunctionParameterAttributeNoReadWrite, Kernel), // clang-format on - })), ); + }))); // See SPIR-V Section 3.20 Decoration -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( Decoration, EnumCapabilityTest, Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), ValuesIn(std::vector{ @@ -460,25 +460,25 @@ INSTANTIATE_TEST_CASE_P( CASE1(DECORATION, DecorationInputAttachmentIndex, InputAttachment), CASE1(DECORATION, DecorationAlignment, Kernel), - })), ); + }))); #if 0 // SpecId has different requirements in v1.0 and v1.1: -INSTANTIATE_TEST_CASE_P(DecorationSpecIdV10, EnumCapabilityTest, +INSTANTIATE_TEST_SUITE_P(DecorationSpecIdV10, EnumCapabilityTest, Combine(Values(SPV_ENV_UNIVERSAL_1_0), ValuesIn(std::vector{CASE1( - DECORATION, DecorationSpecId, Shader)})), ); + DECORATION, DecorationSpecId, Shader)}))); #endif -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( DecorationV11, EnumCapabilityTest, Combine(Values(SPV_ENV_UNIVERSAL_1_1), ValuesIn(std::vector{ CASE2(DECORATION, DecorationSpecId, Shader, Kernel), - CASE1(DECORATION, DecorationMaxByteOffset, Addresses)})), ); + CASE1(DECORATION, DecorationMaxByteOffset, Addresses)}))); // See SPIR-V Section 3.21 BuiltIn -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( BuiltIn, EnumCapabilityTest, Combine( Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), @@ -530,38 +530,38 @@ INSTANTIATE_TEST_CASE_P( CASE1(BUILT_IN, BuiltInVertexIndex, Shader), CASE1(BUILT_IN, BuiltInInstanceIndex, Shader), // clang-format on - })), ); + }))); // See SPIR-V Section 3.22 Selection Control -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SelectionControl, EnumCapabilityTest, Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), ValuesIn(std::vector{ CASE0(SELECTION_CONTROL, SelectionControlMaskNone), CASE0(SELECTION_CONTROL, SelectionControlFlattenMask), CASE0(SELECTION_CONTROL, SelectionControlDontFlattenMask), - })), ); + }))); // See SPIR-V Section 3.23 Loop Control -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( LoopControl, EnumCapabilityTest, Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), ValuesIn(std::vector{ CASE0(LOOP_CONTROL, LoopControlMaskNone), CASE0(LOOP_CONTROL, LoopControlUnrollMask), CASE0(LOOP_CONTROL, LoopControlDontUnrollMask), - })), ); + }))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( LoopControlV11, EnumCapabilityTest, Combine(Values(SPV_ENV_UNIVERSAL_1_1), ValuesIn(std::vector{ CASE0(LOOP_CONTROL, LoopControlDependencyInfiniteMask), CASE0(LOOP_CONTROL, LoopControlDependencyLengthMask), - })), ); + }))); // See SPIR-V Section 3.24 Function Control -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( FunctionControl, EnumCapabilityTest, Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), ValuesIn(std::vector{ @@ -570,10 +570,10 @@ INSTANTIATE_TEST_CASE_P( CASE0(FUNCTION_CONTROL, FunctionControlDontInlineMask), CASE0(FUNCTION_CONTROL, FunctionControlPureMask), CASE0(FUNCTION_CONTROL, FunctionControlConstMask), - })), ); + }))); // See SPIR-V Section 3.25 Memory Semantics -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( MemorySemantics, EnumCapabilityTest, Combine( Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), @@ -592,10 +592,10 @@ INSTANTIATE_TEST_CASE_P( CASE1(MEMORY_SEMANTICS_ID, MemorySemanticsAtomicCounterMemoryMask, AtomicStorage), // Bug 15234 CASE0(MEMORY_SEMANTICS_ID, MemorySemanticsImageMemoryMask), - })), ); + }))); // See SPIR-V Section 3.26 Memory Access -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( MemoryAccess, EnumCapabilityTest, Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), ValuesIn(std::vector{ @@ -603,10 +603,10 @@ INSTANTIATE_TEST_CASE_P( CASE0(OPTIONAL_MEMORY_ACCESS, MemoryAccessVolatileMask), CASE0(OPTIONAL_MEMORY_ACCESS, MemoryAccessAlignedMask), CASE0(OPTIONAL_MEMORY_ACCESS, MemoryAccessNontemporalMask), - })), ); + }))); // See SPIR-V Section 3.27 Scope -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( Scope, EnumCapabilityTest, Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1, SPV_ENV_UNIVERSAL_1_2, SPV_ENV_UNIVERSAL_1_3), @@ -617,10 +617,10 @@ INSTANTIATE_TEST_CASE_P( CASE0(SCOPE_ID, ScopeSubgroup), CASE0(SCOPE_ID, ScopeInvocation), CASE1(SCOPE_ID, ScopeQueueFamilyKHR, VulkanMemoryModelKHR), - })), ); + }))); // See SPIR-V Section 3.28 Group Operation -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( GroupOperation, EnumCapabilityTest, Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), ValuesIn(std::vector{ @@ -630,10 +630,10 @@ INSTANTIATE_TEST_CASE_P( GroupNonUniformArithmetic, GroupNonUniformBallot), CASE3(GROUP_OPERATION, GroupOperationExclusiveScan, Kernel, GroupNonUniformArithmetic, GroupNonUniformBallot), - })), ); + }))); // See SPIR-V Section 3.29 Kernel Enqueue Flags -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( KernelEnqueueFlags, EnumCapabilityTest, Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), ValuesIn(std::vector{ @@ -641,20 +641,20 @@ INSTANTIATE_TEST_CASE_P( CASE1(KERNEL_ENQ_FLAGS, KernelEnqueueFlagsWaitKernel, Kernel), CASE1(KERNEL_ENQ_FLAGS, KernelEnqueueFlagsWaitWorkGroup, Kernel), - })), ); + }))); // See SPIR-V Section 3.30 Kernel Profiling Info -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( KernelProfilingInfo, EnumCapabilityTest, Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), ValuesIn(std::vector{ CASE0(KERNEL_PROFILING_INFO, KernelProfilingInfoMaskNone), CASE1(KERNEL_PROFILING_INFO, KernelProfilingInfoCmdExecTimeMask, Kernel), - })), ); + }))); // See SPIR-V Section 3.31 Capability -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( CapabilityDependsOn, EnumCapabilityTest, Combine( Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), @@ -717,16 +717,16 @@ INSTANTIATE_TEST_CASE_P( CASE1(CAPABILITY, CapabilityStorageImageWriteWithoutFormat, Shader), CASE1(CAPABILITY, CapabilityMultiViewport, Geometry), // clang-format on - })), ); + }))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( CapabilityDependsOnV11, EnumCapabilityTest, Combine(Values(SPV_ENV_UNIVERSAL_1_1), ValuesIn(std::vector{ CASE1(CAPABILITY, CapabilitySubgroupDispatch, DeviceEnqueue), CASE1(CAPABILITY, CapabilityNamedBarrier, Kernel), CASE1(CAPABILITY, CapabilityPipeStorage, Pipes), - })), ); + }))); #undef CASE0 #undef CASE1 diff --git a/3rdparty/spirv-tools/test/operand_pattern_test.cpp b/3rdparty/spirv-tools/test/operand_pattern_test.cpp index d2d92a01d..1caf008fb 100644 --- a/3rdparty/spirv-tools/test/operand_pattern_test.cpp +++ b/3rdparty/spirv-tools/test/operand_pattern_test.cpp @@ -84,7 +84,7 @@ TEST_P(MaskExpansionTest, Sample) { #define PREFIX1 \ SPV_OPERAND_TYPE_STORAGE_CLASS, SPV_OPERAND_TYPE_SAMPLER_FILTER_MODE, \ SPV_OPERAND_TYPE_ID -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( OperandPattern, MaskExpansionTest, ::testing::ValuesIn(std::vector{ // No bits means no change. @@ -111,7 +111,7 @@ INSTANTIATE_TEST_CASE_P( SpvMemoryAccessVolatileMask | SpvMemoryAccessAlignedMask, {PREFIX1}, {PREFIX1, SPV_OPERAND_TYPE_LITERAL_INTEGER}}, - }), ); + })); #undef PREFIX0 #undef PREFIX1 @@ -137,9 +137,9 @@ TEST_P(MatchableOperandExpansionTest, MatchableOperandsDontExpand) { } } -INSTANTIATE_TEST_CASE_P(MatchableOperandExpansion, - MatchableOperandExpansionTest, - ::testing::ValuesIn(allOperandTypes()), ); +INSTANTIATE_TEST_SUITE_P(MatchableOperandExpansion, + MatchableOperandExpansionTest, + ::testing::ValuesIn(allOperandTypes())); using VariableOperandExpansionTest = ::testing::TestWithParam; @@ -157,9 +157,9 @@ TEST_P(VariableOperandExpansionTest, NonMatchableOperandsExpand) { } } -INSTANTIATE_TEST_CASE_P(NonMatchableOperandExpansion, - VariableOperandExpansionTest, - ::testing::ValuesIn(allOperandTypes()), ); +INSTANTIATE_TEST_SUITE_P(NonMatchableOperandExpansion, + VariableOperandExpansionTest, + ::testing::ValuesIn(allOperandTypes())); TEST(AlternatePatternFollowingImmediate, Empty) { EXPECT_THAT(spvAlternatePatternFollowingImmediate({}), diff --git a/3rdparty/spirv-tools/test/operand_test.cpp b/3rdparty/spirv-tools/test/operand_test.cpp index 08522c323..4e2c3215b 100644 --- a/3rdparty/spirv-tools/test/operand_test.cpp +++ b/3rdparty/spirv-tools/test/operand_test.cpp @@ -33,10 +33,10 @@ TEST_P(GetTargetTest, InvalidPointerTable) { ASSERT_EQ(SPV_ERROR_INVALID_POINTER, spvOperandTableGet(nullptr, GetParam())); } -INSTANTIATE_TEST_CASE_P(OperandTableGet, GetTargetTest, - ValuesIn(std::vector{ - SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1, - SPV_ENV_VULKAN_1_0}), ); +INSTANTIATE_TEST_SUITE_P(OperandTableGet, GetTargetTest, + ValuesIn(std::vector{ + SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1, + SPV_ENV_VULKAN_1_0})); TEST(OperandString, AllAreDefinedExceptVariable) { // None has no string, so don't test it. diff --git a/3rdparty/spirv-tools/test/opt/aggressive_dead_code_elim_test.cpp b/3rdparty/spirv-tools/test/opt/aggressive_dead_code_elim_test.cpp index e58a76f71..3e09a0575 100644 --- a/3rdparty/spirv-tools/test/opt/aggressive_dead_code_elim_test.cpp +++ b/3rdparty/spirv-tools/test/opt/aggressive_dead_code_elim_test.cpp @@ -4254,7 +4254,7 @@ TEST_P(AggressiveEliminateDeadConstantTest, Custom) { SinglePassRunAndMatch(assembly_with_dead_const, false); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ScalarTypeConstants, AggressiveEliminateDeadConstantTest, ::testing::ValuesIn(std::vector({ // clang-format off @@ -4346,7 +4346,7 @@ INSTANTIATE_TEST_CASE_P( // clang-format on }))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( VectorTypeConstants, AggressiveEliminateDeadConstantTest, ::testing::ValuesIn(std::vector({ // clang-format off @@ -4473,7 +4473,7 @@ INSTANTIATE_TEST_CASE_P( // clang-format on }))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( StructTypeConstants, AggressiveEliminateDeadConstantTest, ::testing::ValuesIn(std::vector({ // clang-format off @@ -4644,7 +4644,7 @@ INSTANTIATE_TEST_CASE_P( // clang-format on }))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ScalarTypeSpecConstants, AggressiveEliminateDeadConstantTest, ::testing::ValuesIn(std::vector({ // clang-format off @@ -4697,7 +4697,7 @@ INSTANTIATE_TEST_CASE_P( // clang-format on }))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( VectorTypeSpecConstants, AggressiveEliminateDeadConstantTest, ::testing::ValuesIn(std::vector({ // clang-format off @@ -4819,7 +4819,7 @@ INSTANTIATE_TEST_CASE_P( // clang-format on }))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SpecConstantOp, AggressiveEliminateDeadConstantTest, ::testing::ValuesIn(std::vector({ // clang-format off @@ -5001,7 +5001,7 @@ INSTANTIATE_TEST_CASE_P( // clang-format on }))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( LongDefUseChain, AggressiveEliminateDeadConstantTest, ::testing::ValuesIn(std::vector({ // clang-format off diff --git a/3rdparty/spirv-tools/test/opt/block_merge_test.cpp b/3rdparty/spirv-tools/test/opt/block_merge_test.cpp index 654e88019..64ee9523f 100644 --- a/3rdparty/spirv-tools/test/opt/block_merge_test.cpp +++ b/3rdparty/spirv-tools/test/opt/block_merge_test.cpp @@ -741,6 +741,145 @@ OpFunctionEnd SinglePassRunAndMatch(text, true); } +TEST_F(BlockMergeTest, OpPhiInSuccessor) { + // Checks that when merging blocks A and B, the OpPhi at the start of B is + // removed and uses of its definition are replaced appropriately. + const std::string prefix = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +OpExecutionMode %main OriginUpperLeft +OpSource ESSL 310 +OpName %main "main" +OpName %x "x" +OpName %y "y" +%void = OpTypeVoid +%6 = OpTypeFunction %void +%int = OpTypeInt 32 1 +%_ptr_Function_int = OpTypePointer Function %int +%int_1 = OpConstant %int 1 +%main = OpFunction %void None %6 +%10 = OpLabel +%x = OpVariable %_ptr_Function_int Function +%y = OpVariable %_ptr_Function_int Function +OpStore %x %int_1 +%11 = OpLoad %int %x +)"; + + const std::string suffix_before = + R"(OpBranch %12 +%12 = OpLabel +%13 = OpPhi %int %11 %10 +OpStore %y %13 +OpReturn +OpFunctionEnd +)"; + + const std::string suffix_after = + R"(OpStore %y %11 +OpReturn +OpFunctionEnd +)"; + SinglePassRunAndCheck(prefix + suffix_before, + prefix + suffix_after, true, true); +} + +TEST_F(BlockMergeTest, MultipleOpPhisInSuccessor) { + // Checks that when merging blocks A and B, the OpPhis at the start of B are + // removed and uses of their definitions are replaced appropriately. + const std::string prefix = + R"(OpCapability Shader +%1 = OpExtInstImport "GLSL.std.450" +OpMemoryModel Logical GLSL450 +OpEntryPoint Fragment %main "main" +OpExecutionMode %main OriginUpperLeft +OpSource ESSL 310 +OpName %main "main" +OpName %S "S" +OpMemberName %S 0 "x" +OpMemberName %S 1 "f" +OpName %s "s" +OpName %g "g" +OpName %y "y" +OpName %t "t" +OpName %z "z" +%void = OpTypeVoid +%10 = OpTypeFunction %void +%int = OpTypeInt 32 1 +%float = OpTypeFloat 32 +%S = OpTypeStruct %int %float +%_ptr_Function_S = OpTypePointer Function %S +%int_1 = OpConstant %int 1 +%float_2 = OpConstant %float 2 +%16 = OpConstantComposite %S %int_1 %float_2 +%_ptr_Function_float = OpTypePointer Function %float +%_ptr_Function_int = OpTypePointer Function %int +%int_3 = OpConstant %int 3 +%int_0 = OpConstant %int 0 +%main = OpFunction %void None %10 +%21 = OpLabel +%s = OpVariable %_ptr_Function_S Function +%g = OpVariable %_ptr_Function_float Function +%y = OpVariable %_ptr_Function_int Function +%t = OpVariable %_ptr_Function_S Function +%z = OpVariable %_ptr_Function_float Function +OpStore %s %16 +OpStore %g %float_2 +OpStore %y %int_3 +%22 = OpLoad %S %s +OpStore %t %22 +%23 = OpAccessChain %_ptr_Function_float %s %int_1 +%24 = OpLoad %float %23 +%25 = OpLoad %float %g +)"; + + const std::string suffix_before = + R"(OpBranch %26 +%26 = OpLabel +%27 = OpPhi %float %24 %21 +%28 = OpPhi %float %25 %21 +%29 = OpFAdd %float %27 %28 +%30 = OpAccessChain %_ptr_Function_int %s %int_0 +%31 = OpLoad %int %30 +OpBranch %32 +%32 = OpLabel +%33 = OpPhi %float %29 %26 +%34 = OpPhi %int %31 %26 +%35 = OpConvertSToF %float %34 +OpBranch %36 +%36 = OpLabel +%37 = OpPhi %float %35 %32 +%38 = OpFSub %float %33 %37 +%39 = OpLoad %int %y +OpBranch %40 +%40 = OpLabel +%41 = OpPhi %float %38 %36 +%42 = OpPhi %int %39 %36 +%43 = OpConvertSToF %float %42 +%44 = OpFAdd %float %41 %43 +OpStore %z %44 +OpReturn +OpFunctionEnd +)"; + + const std::string suffix_after = + R"(%29 = OpFAdd %float %24 %25 +%30 = OpAccessChain %_ptr_Function_int %s %int_0 +%31 = OpLoad %int %30 +%35 = OpConvertSToF %float %31 +%38 = OpFSub %float %29 %35 +%39 = OpLoad %int %y +%43 = OpConvertSToF %float %39 +%44 = OpFAdd %float %38 %43 +OpStore %z %44 +OpReturn +OpFunctionEnd +)"; + SinglePassRunAndCheck(prefix + suffix_before, + prefix + suffix_after, true, true); +} + // TODO(greg-lunarg): Add tests to verify handling of these cases: // // More complex control flow diff --git a/3rdparty/spirv-tools/test/opt/def_use_test.cpp b/3rdparty/spirv-tools/test/opt/def_use_test.cpp index 3b856ce7f..cfdad74a1 100644 --- a/3rdparty/spirv-tools/test/opt/def_use_test.cpp +++ b/3rdparty/spirv-tools/test/opt/def_use_test.cpp @@ -206,7 +206,7 @@ TEST_P(ParseDefUseTest, Case) { } // clang-format off -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TestCase, ParseDefUseTest, ::testing::ValuesIn(std::vector{ {"", {{}, {}}}, // no instruction @@ -629,7 +629,7 @@ TEST_P(ReplaceUseTest, Case) { } // clang-format off -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TestCase, ReplaceUseTest, ::testing::ValuesIn(std::vector{ { // no use, no replace request @@ -981,7 +981,7 @@ TEST_P(KillDefTest, Case) { } // clang-format off -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TestCase, KillDefTest, ::testing::ValuesIn(std::vector{ { // no def, no use, no kill @@ -1343,7 +1343,7 @@ TEST_P(AnalyzeInstDefUseTest, Case) { } // clang-format off -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TestCase, AnalyzeInstDefUseTest, ::testing::ValuesIn(std::vector{ { // A type declaring instruction. @@ -1464,7 +1464,7 @@ TEST_P(KillInstTest, Case) { } // clang-format off -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TestCase, KillInstTest, ::testing::ValuesIn(std::vector{ // Kill id defining instructions. @@ -1588,7 +1588,7 @@ TEST_P(GetAnnotationsTest, Case) { } // clang-format off -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TestCase, GetAnnotationsTest, ::testing::ValuesIn(std::vector{ // empty diff --git a/3rdparty/spirv-tools/test/opt/eliminate_dead_const_test.cpp b/3rdparty/spirv-tools/test/opt/eliminate_dead_const_test.cpp index 7fac866ce..59f06f9f2 100644 --- a/3rdparty/spirv-tools/test/opt/eliminate_dead_const_test.cpp +++ b/3rdparty/spirv-tools/test/opt/eliminate_dead_const_test.cpp @@ -197,7 +197,7 @@ TEST_P(EliminateDeadConstantTest, Custom) { assembly_with_dead_const, expected, /* skip_nop = */ true); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ScalarTypeConstants, EliminateDeadConstantTest, ::testing::ValuesIn(std::vector({ // clang-format off @@ -265,7 +265,7 @@ INSTANTIATE_TEST_CASE_P( // clang-format on }))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( VectorTypeConstants, EliminateDeadConstantTest, ::testing::ValuesIn(std::vector({ // clang-format off @@ -358,7 +358,7 @@ INSTANTIATE_TEST_CASE_P( // clang-format on }))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( StructTypeConstants, EliminateDeadConstantTest, ::testing::ValuesIn(std::vector({ // clang-format off @@ -485,7 +485,7 @@ INSTANTIATE_TEST_CASE_P( // clang-format on }))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ScalarTypeSpecConstants, EliminateDeadConstantTest, ::testing::ValuesIn(std::vector({ // clang-format off @@ -522,7 +522,7 @@ INSTANTIATE_TEST_CASE_P( // clang-format on }))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( VectorTypeSpecConstants, EliminateDeadConstantTest, ::testing::ValuesIn(std::vector({ // clang-format off @@ -617,7 +617,7 @@ INSTANTIATE_TEST_CASE_P( // clang-format on }))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SpecConstantOp, EliminateDeadConstantTest, ::testing::ValuesIn(std::vector({ // clang-format off @@ -768,7 +768,7 @@ INSTANTIATE_TEST_CASE_P( // clang-format on }))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( LongDefUseChain, EliminateDeadConstantTest, ::testing::ValuesIn(std::vector({ // clang-format off diff --git a/3rdparty/spirv-tools/test/opt/flatten_decoration_test.cpp b/3rdparty/spirv-tools/test/opt/flatten_decoration_test.cpp index fcf2341e7..d8d886771 100644 --- a/3rdparty/spirv-tools/test/opt/flatten_decoration_test.cpp +++ b/3rdparty/spirv-tools/test/opt/flatten_decoration_test.cpp @@ -81,158 +81,158 @@ TEST_P(FlattenDecorationTest, TransformsDecorations) { SinglePassRunAndCheck(before, after, false, true); } -INSTANTIATE_TEST_CASE_P(NoUses, FlattenDecorationTest, - ::testing::ValuesIn(std::vector{ - // No OpDecorationGroup - {"", ""}, +INSTANTIATE_TEST_SUITE_P(NoUses, FlattenDecorationTest, + ::testing::ValuesIn(std::vector{ + // No OpDecorationGroup + {"", ""}, - // OpDecorationGroup without any uses, and - // no OpName. - {"%group = OpDecorationGroup\n", ""}, + // OpDecorationGroup without any uses, and + // no OpName. + {"%group = OpDecorationGroup\n", ""}, - // OpDecorationGroup without any uses, and - // with OpName targeting it. Proves you must - // remove the names as well. - {"OpName %group \"group\"\n" - "%group = OpDecorationGroup\n", - ""}, + // OpDecorationGroup without any uses, and + // with OpName targeting it. Proves you must + // remove the names as well. + {"OpName %group \"group\"\n" + "%group = OpDecorationGroup\n", + ""}, - // OpDecorationGroup with decorations that - // target it, but no uses in OpGroupDecorate - // or OpGroupMemberDecorate instructions. - {"OpDecorate %group Flat\n" - "OpDecorate %group NoPerspective\n" - "%group = OpDecorationGroup\n", - ""}, - }), ); + // OpDecorationGroup with decorations that + // target it, but no uses in OpGroupDecorate + // or OpGroupMemberDecorate instructions. + {"OpDecorate %group Flat\n" + "OpDecorate %group NoPerspective\n" + "%group = OpDecorationGroup\n", + ""}, + })); -INSTANTIATE_TEST_CASE_P(OpGroupDecorate, FlattenDecorationTest, - ::testing::ValuesIn(std::vector{ - // One OpGroupDecorate - {"OpName %group \"group\"\n" - "OpDecorate %group Flat\n" - "OpDecorate %group NoPerspective\n" - "%group = OpDecorationGroup\n" - "OpGroupDecorate %group %hue %saturation\n", - "OpDecorate %hue Flat\n" - "OpDecorate %saturation Flat\n" - "OpDecorate %hue NoPerspective\n" - "OpDecorate %saturation NoPerspective\n"}, - // Multiple OpGroupDecorate - {"OpName %group \"group\"\n" - "OpDecorate %group Flat\n" - "OpDecorate %group NoPerspective\n" - "%group = OpDecorationGroup\n" - "OpGroupDecorate %group %hue %value\n" - "OpGroupDecorate %group %saturation\n", - "OpDecorate %hue Flat\n" - "OpDecorate %value Flat\n" - "OpDecorate %saturation Flat\n" - "OpDecorate %hue NoPerspective\n" - "OpDecorate %value NoPerspective\n" - "OpDecorate %saturation NoPerspective\n"}, - // Two group decorations, interleaved - {"OpName %group0 \"group0\"\n" - "OpName %group1 \"group1\"\n" - "OpDecorate %group0 Flat\n" - "OpDecorate %group1 NoPerspective\n" - "%group0 = OpDecorationGroup\n" - "%group1 = OpDecorationGroup\n" - "OpGroupDecorate %group0 %hue %value\n" - "OpGroupDecorate %group1 %saturation\n", - "OpDecorate %hue Flat\n" - "OpDecorate %value Flat\n" - "OpDecorate %saturation NoPerspective\n"}, - // Decoration with operands - {"OpName %group \"group\"\n" - "OpDecorate %group Location 42\n" - "%group = OpDecorationGroup\n" - "OpGroupDecorate %group %hue %saturation\n", - "OpDecorate %hue Location 42\n" - "OpDecorate %saturation Location 42\n"}, - }), ); +INSTANTIATE_TEST_SUITE_P(OpGroupDecorate, FlattenDecorationTest, + ::testing::ValuesIn(std::vector{ + // One OpGroupDecorate + {"OpName %group \"group\"\n" + "OpDecorate %group Flat\n" + "OpDecorate %group NoPerspective\n" + "%group = OpDecorationGroup\n" + "OpGroupDecorate %group %hue %saturation\n", + "OpDecorate %hue Flat\n" + "OpDecorate %saturation Flat\n" + "OpDecorate %hue NoPerspective\n" + "OpDecorate %saturation NoPerspective\n"}, + // Multiple OpGroupDecorate + {"OpName %group \"group\"\n" + "OpDecorate %group Flat\n" + "OpDecorate %group NoPerspective\n" + "%group = OpDecorationGroup\n" + "OpGroupDecorate %group %hue %value\n" + "OpGroupDecorate %group %saturation\n", + "OpDecorate %hue Flat\n" + "OpDecorate %value Flat\n" + "OpDecorate %saturation Flat\n" + "OpDecorate %hue NoPerspective\n" + "OpDecorate %value NoPerspective\n" + "OpDecorate %saturation NoPerspective\n"}, + // Two group decorations, interleaved + {"OpName %group0 \"group0\"\n" + "OpName %group1 \"group1\"\n" + "OpDecorate %group0 Flat\n" + "OpDecorate %group1 NoPerspective\n" + "%group0 = OpDecorationGroup\n" + "%group1 = OpDecorationGroup\n" + "OpGroupDecorate %group0 %hue %value\n" + "OpGroupDecorate %group1 %saturation\n", + "OpDecorate %hue Flat\n" + "OpDecorate %value Flat\n" + "OpDecorate %saturation NoPerspective\n"}, + // Decoration with operands + {"OpName %group \"group\"\n" + "OpDecorate %group Location 42\n" + "%group = OpDecorationGroup\n" + "OpGroupDecorate %group %hue %saturation\n", + "OpDecorate %hue Location 42\n" + "OpDecorate %saturation Location 42\n"}, + })); -INSTANTIATE_TEST_CASE_P(OpGroupMemberDecorate, FlattenDecorationTest, - ::testing::ValuesIn(std::vector{ - // One OpGroupMemberDecorate - {"OpName %group \"group\"\n" - "OpDecorate %group Flat\n" - "OpDecorate %group Offset 16\n" - "%group = OpDecorationGroup\n" - "OpGroupMemberDecorate %group %Point 1\n", - "OpMemberDecorate %Point 1 Flat\n" - "OpMemberDecorate %Point 1 Offset 16\n"}, - // Multiple OpGroupMemberDecorate using the same - // decoration group. - {"OpName %group \"group\"\n" - "OpDecorate %group Flat\n" - "OpDecorate %group NoPerspective\n" - "OpDecorate %group Offset 8\n" - "%group = OpDecorationGroup\n" - "OpGroupMemberDecorate %group %Point 2\n" - "OpGroupMemberDecorate %group %Camera 1\n", - "OpMemberDecorate %Point 2 Flat\n" - "OpMemberDecorate %Camera 1 Flat\n" - "OpMemberDecorate %Point 2 NoPerspective\n" - "OpMemberDecorate %Camera 1 NoPerspective\n" - "OpMemberDecorate %Point 2 Offset 8\n" - "OpMemberDecorate %Camera 1 Offset 8\n"}, - // Two groups of member decorations, interleaved. - // Decoration is with and without operands. - {"OpName %group0 \"group0\"\n" - "OpName %group1 \"group1\"\n" - "OpDecorate %group0 Flat\n" - "OpDecorate %group0 Offset 8\n" - "OpDecorate %group1 NoPerspective\n" - "OpDecorate %group1 Offset 16\n" - "%group0 = OpDecorationGroup\n" - "%group1 = OpDecorationGroup\n" - "OpGroupMemberDecorate %group0 %Point 0\n" - "OpGroupMemberDecorate %group1 %Point 2\n", - "OpMemberDecorate %Point 0 Flat\n" - "OpMemberDecorate %Point 0 Offset 8\n" - "OpMemberDecorate %Point 2 NoPerspective\n" - "OpMemberDecorate %Point 2 Offset 16\n"}, - }), ); +INSTANTIATE_TEST_SUITE_P(OpGroupMemberDecorate, FlattenDecorationTest, + ::testing::ValuesIn(std::vector{ + // One OpGroupMemberDecorate + {"OpName %group \"group\"\n" + "OpDecorate %group Flat\n" + "OpDecorate %group Offset 16\n" + "%group = OpDecorationGroup\n" + "OpGroupMemberDecorate %group %Point 1\n", + "OpMemberDecorate %Point 1 Flat\n" + "OpMemberDecorate %Point 1 Offset 16\n"}, + // Multiple OpGroupMemberDecorate using the same + // decoration group. + {"OpName %group \"group\"\n" + "OpDecorate %group Flat\n" + "OpDecorate %group NoPerspective\n" + "OpDecorate %group Offset 8\n" + "%group = OpDecorationGroup\n" + "OpGroupMemberDecorate %group %Point 2\n" + "OpGroupMemberDecorate %group %Camera 1\n", + "OpMemberDecorate %Point 2 Flat\n" + "OpMemberDecorate %Camera 1 Flat\n" + "OpMemberDecorate %Point 2 NoPerspective\n" + "OpMemberDecorate %Camera 1 NoPerspective\n" + "OpMemberDecorate %Point 2 Offset 8\n" + "OpMemberDecorate %Camera 1 Offset 8\n"}, + // Two groups of member decorations, interleaved. + // Decoration is with and without operands. + {"OpName %group0 \"group0\"\n" + "OpName %group1 \"group1\"\n" + "OpDecorate %group0 Flat\n" + "OpDecorate %group0 Offset 8\n" + "OpDecorate %group1 NoPerspective\n" + "OpDecorate %group1 Offset 16\n" + "%group0 = OpDecorationGroup\n" + "%group1 = OpDecorationGroup\n" + "OpGroupMemberDecorate %group0 %Point 0\n" + "OpGroupMemberDecorate %group1 %Point 2\n", + "OpMemberDecorate %Point 0 Flat\n" + "OpMemberDecorate %Point 0 Offset 8\n" + "OpMemberDecorate %Point 2 NoPerspective\n" + "OpMemberDecorate %Point 2 Offset 16\n"}, + })); -INSTANTIATE_TEST_CASE_P(UnrelatedDecorations, FlattenDecorationTest, - ::testing::ValuesIn(std::vector{ - // A non-group non-member decoration is untouched. - {"OpDecorate %hue Centroid\n" - "OpDecorate %saturation Flat\n", - "OpDecorate %hue Centroid\n" - "OpDecorate %saturation Flat\n"}, - // A non-group member decoration is untouched. - {"OpMemberDecorate %Point 0 Offset 0\n" - "OpMemberDecorate %Point 1 Offset 4\n" - "OpMemberDecorate %Point 1 Flat\n", - "OpMemberDecorate %Point 0 Offset 0\n" - "OpMemberDecorate %Point 1 Offset 4\n" - "OpMemberDecorate %Point 1 Flat\n"}, - // A non-group non-member decoration survives any - // replacement of group decorations. - {"OpName %group \"group\"\n" - "OpDecorate %group Flat\n" - "OpDecorate %hue Centroid\n" - "OpDecorate %group NoPerspective\n" - "%group = OpDecorationGroup\n" - "OpGroupDecorate %group %hue %saturation\n", - "OpDecorate %hue Flat\n" - "OpDecorate %saturation Flat\n" - "OpDecorate %hue Centroid\n" - "OpDecorate %hue NoPerspective\n" - "OpDecorate %saturation NoPerspective\n"}, - // A non-group member decoration survives any - // replacement of group decorations. - {"OpDecorate %group Offset 0\n" - "OpDecorate %group Flat\n" - "OpMemberDecorate %Point 1 Offset 4\n" - "%group = OpDecorationGroup\n" - "OpGroupMemberDecorate %group %Point 0\n", - "OpMemberDecorate %Point 0 Offset 0\n" - "OpMemberDecorate %Point 0 Flat\n" - "OpMemberDecorate %Point 1 Offset 4\n"}, - }), ); +INSTANTIATE_TEST_SUITE_P(UnrelatedDecorations, FlattenDecorationTest, + ::testing::ValuesIn(std::vector{ + // A non-group non-member decoration is untouched. + {"OpDecorate %hue Centroid\n" + "OpDecorate %saturation Flat\n", + "OpDecorate %hue Centroid\n" + "OpDecorate %saturation Flat\n"}, + // A non-group member decoration is untouched. + {"OpMemberDecorate %Point 0 Offset 0\n" + "OpMemberDecorate %Point 1 Offset 4\n" + "OpMemberDecorate %Point 1 Flat\n", + "OpMemberDecorate %Point 0 Offset 0\n" + "OpMemberDecorate %Point 1 Offset 4\n" + "OpMemberDecorate %Point 1 Flat\n"}, + // A non-group non-member decoration survives any + // replacement of group decorations. + {"OpName %group \"group\"\n" + "OpDecorate %group Flat\n" + "OpDecorate %hue Centroid\n" + "OpDecorate %group NoPerspective\n" + "%group = OpDecorationGroup\n" + "OpGroupDecorate %group %hue %saturation\n", + "OpDecorate %hue Flat\n" + "OpDecorate %saturation Flat\n" + "OpDecorate %hue Centroid\n" + "OpDecorate %hue NoPerspective\n" + "OpDecorate %saturation NoPerspective\n"}, + // A non-group member decoration survives any + // replacement of group decorations. + {"OpDecorate %group Offset 0\n" + "OpDecorate %group Flat\n" + "OpMemberDecorate %Point 1 Offset 4\n" + "%group = OpDecorationGroup\n" + "OpGroupMemberDecorate %group %Point 0\n", + "OpMemberDecorate %Point 0 Offset 0\n" + "OpMemberDecorate %Point 0 Flat\n" + "OpMemberDecorate %Point 1 Offset 4\n"}, + })); } // namespace } // namespace opt diff --git a/3rdparty/spirv-tools/test/opt/fold_spec_const_op_composite_test.cpp b/3rdparty/spirv-tools/test/opt/fold_spec_const_op_composite_test.cpp index 8ecfd5c78..12f0cd125 100644 --- a/3rdparty/spirv-tools/test/opt/fold_spec_const_op_composite_test.cpp +++ b/3rdparty/spirv-tools/test/opt/fold_spec_const_op_composite_test.cpp @@ -224,7 +224,7 @@ TEST_P(FoldSpecConstantOpAndCompositePassTest, ParamTestCase) { // Tests that OpSpecConstantComposite opcodes are replace with // OpConstantComposite correctly. -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( Composite, FoldSpecConstantOpAndCompositePassTest, ::testing::ValuesIn(std::vector< FoldSpecConstantOpAndCompositePassTestCase>({ @@ -330,7 +330,7 @@ INSTANTIATE_TEST_CASE_P( }))); // Tests for operations that resulting in different types. -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( Cast, FoldSpecConstantOpAndCompositePassTest, ::testing::ValuesIn( std::vector({ @@ -567,7 +567,7 @@ INSTANTIATE_TEST_CASE_P( // Tests about boolean scalar logical operations and comparison operations with // scalar int/uint type. -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( Logical, FoldSpecConstantOpAndCompositePassTest, ::testing::ValuesIn(std::vector< FoldSpecConstantOpAndCompositePassTestCase>({ @@ -636,7 +636,7 @@ INSTANTIATE_TEST_CASE_P( }))); // Tests about arithmetic operations for scalar int and uint types. -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ScalarArithmetic, FoldSpecConstantOpAndCompositePassTest, ::testing::ValuesIn(std::vector< FoldSpecConstantOpAndCompositePassTestCase>({ @@ -821,7 +821,7 @@ INSTANTIATE_TEST_CASE_P( }))); // Tests about arithmetic operations for vector int and uint types. -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( VectorArithmetic, FoldSpecConstantOpAndCompositePassTest, ::testing::ValuesIn(std::vector< FoldSpecConstantOpAndCompositePassTestCase>({ @@ -1043,7 +1043,7 @@ INSTANTIATE_TEST_CASE_P( }))); // Tests for SpecConstantOp CompositeExtract instruction -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( CompositeExtract, FoldSpecConstantOpAndCompositePassTest, ::testing::ValuesIn(std::vector< FoldSpecConstantOpAndCompositePassTestCase>({ @@ -1217,7 +1217,7 @@ INSTANTIATE_TEST_CASE_P( }))); // Tests the swizzle operations for spec const vectors. -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( VectorShuffle, FoldSpecConstantOpAndCompositePassTest, ::testing::ValuesIn(std::vector< FoldSpecConstantOpAndCompositePassTestCase>({ @@ -1310,7 +1310,7 @@ INSTANTIATE_TEST_CASE_P( }))); // Test with long use-def chain. -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( LongDefUseChain, FoldSpecConstantOpAndCompositePassTest, ::testing::ValuesIn(std::vector< FoldSpecConstantOpAndCompositePassTestCase>({ diff --git a/3rdparty/spirv-tools/test/opt/fold_test.cpp b/3rdparty/spirv-tools/test/opt/fold_test.cpp index 487c18a83..d874953af 100644 --- a/3rdparty/spirv-tools/test/opt/fold_test.cpp +++ b/3rdparty/spirv-tools/test/opt/fold_test.cpp @@ -265,7 +265,7 @@ const std::string& HeaderWithNaN() { } // clang-format off -INSTANTIATE_TEST_CASE_P(TestCase, IntegerInstructionFoldingTest, +INSTANTIATE_TEST_SUITE_P(TestCase, IntegerInstructionFoldingTest, ::testing::Values( // Test case 0: fold 0*n InstructionFoldingCase( @@ -590,7 +590,7 @@ TEST_P(IntVectorInstructionFoldingTest, Case) { } // clang-format off -INSTANTIATE_TEST_CASE_P(TestCase, IntVectorInstructionFoldingTest, +INSTANTIATE_TEST_SUITE_P(TestCase, IntVectorInstructionFoldingTest, ::testing::Values( // Test case 0: fold 0*n InstructionFoldingCase>( @@ -667,7 +667,7 @@ TEST_P(BooleanInstructionFoldingTest, Case) { } // clang-format off -INSTANTIATE_TEST_CASE_P(TestCase, BooleanInstructionFoldingTest, +INSTANTIATE_TEST_SUITE_P(TestCase, BooleanInstructionFoldingTest, ::testing::Values( // Test case 0: fold true || n InstructionFoldingCase( @@ -871,7 +871,7 @@ INSTANTIATE_TEST_CASE_P(TestCase, BooleanInstructionFoldingTest, 2, true) )); -INSTANTIATE_TEST_CASE_P(FClampAndCmpLHS, BooleanInstructionFoldingTest, +INSTANTIATE_TEST_SUITE_P(FClampAndCmpLHS, BooleanInstructionFoldingTest, ::testing::Values( // Test case 0: fold 0.0 > clamp(n, 0.0, 1.0) InstructionFoldingCase( @@ -1051,7 +1051,7 @@ INSTANTIATE_TEST_CASE_P(FClampAndCmpLHS, BooleanInstructionFoldingTest, 2, false) )); -INSTANTIATE_TEST_CASE_P(FClampAndCmpRHS, BooleanInstructionFoldingTest, +INSTANTIATE_TEST_SUITE_P(FClampAndCmpRHS, BooleanInstructionFoldingTest, ::testing::Values( // Test case 0: fold clamp(n, 0.0, 1.0) > 1.0 InstructionFoldingCase( @@ -1281,7 +1281,7 @@ TEST_P(FloatInstructionFoldingTest, Case) { // specification. // clang-format off -INSTANTIATE_TEST_CASE_P(FloatConstantFoldingTest, FloatInstructionFoldingTest, +INSTANTIATE_TEST_SUITE_P(FloatConstantFoldingTest, FloatInstructionFoldingTest, ::testing::Values( // Test case 0: Fold 2.0 - 1.0 InstructionFoldingCase( @@ -1424,7 +1424,7 @@ TEST_P(DoubleInstructionFoldingTest, Case) { } // clang-format off -INSTANTIATE_TEST_CASE_P(DoubleConstantFoldingTest, DoubleInstructionFoldingTest, +INSTANTIATE_TEST_SUITE_P(DoubleConstantFoldingTest, DoubleInstructionFoldingTest, ::testing::Values( // Test case 0: Fold 2.0 - 1.0 InstructionFoldingCase( @@ -1534,7 +1534,7 @@ INSTANTIATE_TEST_CASE_P(DoubleConstantFoldingTest, DoubleInstructionFoldingTest, // clang-format on // clang-format off -INSTANTIATE_TEST_CASE_P(DoubleOrderedCompareConstantFoldingTest, BooleanInstructionFoldingTest, +INSTANTIATE_TEST_SUITE_P(DoubleOrderedCompareConstantFoldingTest, BooleanInstructionFoldingTest, ::testing::Values( // Test case 0: fold 1.0 == 2.0 InstructionFoldingCase( @@ -1666,7 +1666,7 @@ INSTANTIATE_TEST_CASE_P(DoubleOrderedCompareConstantFoldingTest, BooleanInstruct 2, true) )); -INSTANTIATE_TEST_CASE_P(DoubleUnorderedCompareConstantFoldingTest, BooleanInstructionFoldingTest, +INSTANTIATE_TEST_SUITE_P(DoubleUnorderedCompareConstantFoldingTest, BooleanInstructionFoldingTest, ::testing::Values( // Test case 0: fold 1.0 == 2.0 InstructionFoldingCase( @@ -1798,7 +1798,7 @@ INSTANTIATE_TEST_CASE_P(DoubleUnorderedCompareConstantFoldingTest, BooleanInstru 2, true) )); -INSTANTIATE_TEST_CASE_P(FloatOrderedCompareConstantFoldingTest, BooleanInstructionFoldingTest, +INSTANTIATE_TEST_SUITE_P(FloatOrderedCompareConstantFoldingTest, BooleanInstructionFoldingTest, ::testing::Values( // Test case 0: fold 1.0 == 2.0 InstructionFoldingCase( @@ -1930,7 +1930,7 @@ INSTANTIATE_TEST_CASE_P(FloatOrderedCompareConstantFoldingTest, BooleanInstructi 2, true) )); -INSTANTIATE_TEST_CASE_P(FloatUnorderedCompareConstantFoldingTest, BooleanInstructionFoldingTest, +INSTANTIATE_TEST_SUITE_P(FloatUnorderedCompareConstantFoldingTest, BooleanInstructionFoldingTest, ::testing::Values( // Test case 0: fold 1.0 == 2.0 InstructionFoldingCase( @@ -2062,7 +2062,7 @@ INSTANTIATE_TEST_CASE_P(FloatUnorderedCompareConstantFoldingTest, BooleanInstruc 2, true) )); -INSTANTIATE_TEST_CASE_P(DoubleNaNCompareConstantFoldingTest, BooleanInstructionFoldingTest, +INSTANTIATE_TEST_SUITE_P(DoubleNaNCompareConstantFoldingTest, BooleanInstructionFoldingTest, ::testing::Values( // Test case 0: fold NaN == 0 (ord) InstructionFoldingCase( @@ -2098,7 +2098,7 @@ INSTANTIATE_TEST_CASE_P(DoubleNaNCompareConstantFoldingTest, BooleanInstructionF 2, true) )); -INSTANTIATE_TEST_CASE_P(FloatNaNCompareConstantFoldingTest, BooleanInstructionFoldingTest, +INSTANTIATE_TEST_SUITE_P(FloatNaNCompareConstantFoldingTest, BooleanInstructionFoldingTest, ::testing::Values( // Test case 0: fold NaN == 0 (ord) InstructionFoldingCase( @@ -2180,7 +2180,7 @@ TEST_P(IntegerInstructionFoldingTestWithMap, Case) { } } // clang-format off -INSTANTIATE_TEST_CASE_P(TestCase, IntegerInstructionFoldingTestWithMap, +INSTANTIATE_TEST_SUITE_P(TestCase, IntegerInstructionFoldingTestWithMap, ::testing::Values( // Test case 0: fold %3 = 0; %3 * n InstructionFoldingCaseWithMap( @@ -2230,7 +2230,7 @@ TEST_P(BooleanInstructionFoldingTestWithMap, Case) { } // clang-format off -INSTANTIATE_TEST_CASE_P(TestCase, BooleanInstructionFoldingTestWithMap, +INSTANTIATE_TEST_SUITE_P(TestCase, BooleanInstructionFoldingTestWithMap, ::testing::Values( // Test case 0: fold %3 = true; %3 || n InstructionFoldingCaseWithMap( @@ -2280,7 +2280,7 @@ TEST_P(GeneralInstructionFoldingTest, Case) { } // clang-format off -INSTANTIATE_TEST_CASE_P(IntegerArithmeticTestCases, GeneralInstructionFoldingTest, +INSTANTIATE_TEST_SUITE_P(IntegerArithmeticTestCases, GeneralInstructionFoldingTest, ::testing::Values( // Test case 0: Don't fold n * m InstructionFoldingCase( @@ -2740,7 +2740,7 @@ INSTANTIATE_TEST_CASE_P(IntegerArithmeticTestCases, GeneralInstructionFoldingTes 2, 3) )); -INSTANTIATE_TEST_CASE_P(CompositeExtractFoldingTest, GeneralInstructionFoldingTest, +INSTANTIATE_TEST_SUITE_P(CompositeExtractFoldingTest, GeneralInstructionFoldingTest, ::testing::Values( // Test case 0: fold Insert feeding extract InstructionFoldingCase( @@ -2888,7 +2888,7 @@ INSTANTIATE_TEST_CASE_P(CompositeExtractFoldingTest, GeneralInstructionFoldingTe 4, INT_7_ID) )); -INSTANTIATE_TEST_CASE_P(CompositeConstructFoldingTest, GeneralInstructionFoldingTest, +INSTANTIATE_TEST_SUITE_P(CompositeConstructFoldingTest, GeneralInstructionFoldingTest, ::testing::Values( // Test case 0: fold Extracts feeding construct InstructionFoldingCase( @@ -2951,7 +2951,7 @@ INSTANTIATE_TEST_CASE_P(CompositeConstructFoldingTest, GeneralInstructionFolding 2, VEC2_0_ID) )); -INSTANTIATE_TEST_CASE_P(PhiFoldingTest, GeneralInstructionFoldingTest, +INSTANTIATE_TEST_SUITE_P(PhiFoldingTest, GeneralInstructionFoldingTest, ::testing::Values( // Test case 0: Fold phi with the same values for all edges. InstructionFoldingCase( @@ -2993,7 +2993,7 @@ INSTANTIATE_TEST_CASE_P(PhiFoldingTest, GeneralInstructionFoldingTest, 2, 0) )); -INSTANTIATE_TEST_CASE_P(FloatRedundantFoldingTest, GeneralInstructionFoldingTest, +INSTANTIATE_TEST_SUITE_P(FloatRedundantFoldingTest, GeneralInstructionFoldingTest, ::testing::Values( // Test case 0: Don't fold n + 1.0 InstructionFoldingCase( @@ -3211,7 +3211,7 @@ INSTANTIATE_TEST_CASE_P(FloatRedundantFoldingTest, GeneralInstructionFoldingTest 2, 0) )); -INSTANTIATE_TEST_CASE_P(DoubleRedundantFoldingTest, GeneralInstructionFoldingTest, +INSTANTIATE_TEST_SUITE_P(DoubleRedundantFoldingTest, GeneralInstructionFoldingTest, ::testing::Values( // Test case 0: Don't fold n + 1.0 InstructionFoldingCase( @@ -3371,7 +3371,7 @@ INSTANTIATE_TEST_CASE_P(DoubleRedundantFoldingTest, GeneralInstructionFoldingTes 2, 4) )); -INSTANTIATE_TEST_CASE_P(FloatVectorRedundantFoldingTest, GeneralInstructionFoldingTest, +INSTANTIATE_TEST_SUITE_P(FloatVectorRedundantFoldingTest, GeneralInstructionFoldingTest, ::testing::Values( // Test case 0: Don't fold a * vec4(0.0, 0.0, 0.0, 1.0) InstructionFoldingCase( @@ -3405,7 +3405,7 @@ INSTANTIATE_TEST_CASE_P(FloatVectorRedundantFoldingTest, GeneralInstructionFoldi 2, 3) )); -INSTANTIATE_TEST_CASE_P(DoubleVectorRedundantFoldingTest, GeneralInstructionFoldingTest, +INSTANTIATE_TEST_SUITE_P(DoubleVectorRedundantFoldingTest, GeneralInstructionFoldingTest, ::testing::Values( // Test case 0: Don't fold a * vec4(0.0, 0.0, 0.0, 1.0) InstructionFoldingCase( @@ -3439,7 +3439,7 @@ INSTANTIATE_TEST_CASE_P(DoubleVectorRedundantFoldingTest, GeneralInstructionFold 2, 3) )); -INSTANTIATE_TEST_CASE_P(IntegerRedundantFoldingTest, GeneralInstructionFoldingTest, +INSTANTIATE_TEST_SUITE_P(IntegerRedundantFoldingTest, GeneralInstructionFoldingTest, ::testing::Values( // Test case 0: Don't fold n + 1 InstructionFoldingCase( @@ -3523,7 +3523,7 @@ INSTANTIATE_TEST_CASE_P(IntegerRedundantFoldingTest, GeneralInstructionFoldingTe 2, 3) )); -INSTANTIATE_TEST_CASE_P(ClampAndCmpLHS, GeneralInstructionFoldingTest, +INSTANTIATE_TEST_SUITE_P(ClampAndCmpLHS, GeneralInstructionFoldingTest, ::testing::Values( // Test case 0: Don't Fold 0.0 < clamp(-1, 1) InstructionFoldingCase( @@ -3659,7 +3659,7 @@ INSTANTIATE_TEST_CASE_P(ClampAndCmpLHS, GeneralInstructionFoldingTest, 2, 0) )); -INSTANTIATE_TEST_CASE_P(ClampAndCmpRHS, GeneralInstructionFoldingTest, +INSTANTIATE_TEST_SUITE_P(ClampAndCmpRHS, GeneralInstructionFoldingTest, ::testing::Values( // Test case 0: Don't Fold clamp(-1, 1) < 0.0 InstructionFoldingCase( @@ -3795,7 +3795,7 @@ INSTANTIATE_TEST_CASE_P(ClampAndCmpRHS, GeneralInstructionFoldingTest, 2, 0) )); -INSTANTIATE_TEST_CASE_P(FToIConstantFoldingTest, IntegerInstructionFoldingTest, +INSTANTIATE_TEST_SUITE_P(FToIConstantFoldingTest, IntegerInstructionFoldingTest, ::testing::Values( // Test case 0: Fold int(3.0) InstructionFoldingCase( @@ -3815,7 +3815,7 @@ INSTANTIATE_TEST_CASE_P(FToIConstantFoldingTest, IntegerInstructionFoldingTest, 2, 3) )); -INSTANTIATE_TEST_CASE_P(IToFConstantFoldingTest, FloatInstructionFoldingTest, +INSTANTIATE_TEST_SUITE_P(IToFConstantFoldingTest, FloatInstructionFoldingTest, ::testing::Values( // Test case 0: Fold float(3) InstructionFoldingCase( @@ -3870,7 +3870,7 @@ TEST_P(ToNegateFoldingTest, Case) { } // clang-format off -INSTANTIATE_TEST_CASE_P(FloatRedundantSubFoldingTest, ToNegateFoldingTest, +INSTANTIATE_TEST_SUITE_P(FloatRedundantSubFoldingTest, ToNegateFoldingTest, ::testing::Values( // Test case 0: Don't fold 1.0 - n InstructionFoldingCase( @@ -3914,7 +3914,7 @@ INSTANTIATE_TEST_CASE_P(FloatRedundantSubFoldingTest, ToNegateFoldingTest, 2, 3) )); -INSTANTIATE_TEST_CASE_P(DoubleRedundantSubFoldingTest, ToNegateFoldingTest, +INSTANTIATE_TEST_SUITE_P(DoubleRedundantSubFoldingTest, ToNegateFoldingTest, ::testing::Values( // Test case 0: Don't fold 1.0 - n InstructionFoldingCase( @@ -3981,7 +3981,7 @@ TEST_P(MatchingInstructionFoldingTest, Case) { } } -INSTANTIATE_TEST_CASE_P(RedundantIntegerMatching, MatchingInstructionFoldingTest, +INSTANTIATE_TEST_SUITE_P(RedundantIntegerMatching, MatchingInstructionFoldingTest, ::testing::Values( // Test case 0: Fold 0 + n (change sign) InstructionFoldingCase( @@ -4011,7 +4011,7 @@ INSTANTIATE_TEST_CASE_P(RedundantIntegerMatching, MatchingInstructionFoldingTest 2, true) )); -INSTANTIATE_TEST_CASE_P(MergeNegateTest, MatchingInstructionFoldingTest, +INSTANTIATE_TEST_SUITE_P(MergeNegateTest, MatchingInstructionFoldingTest, ::testing::Values( // Test case 0: fold consecutive fnegate // -(-x) = x @@ -4348,7 +4348,7 @@ INSTANTIATE_TEST_CASE_P(MergeNegateTest, MatchingInstructionFoldingTest, 2, true) )); -INSTANTIATE_TEST_CASE_P(ReciprocalFDivTest, MatchingInstructionFoldingTest, +INSTANTIATE_TEST_SUITE_P(ReciprocalFDivTest, MatchingInstructionFoldingTest, ::testing::Values( // Test case 0: scalar reicprocal // x / 0.5 = x * 2.0 @@ -4429,7 +4429,7 @@ INSTANTIATE_TEST_CASE_P(ReciprocalFDivTest, MatchingInstructionFoldingTest, 3, false) )); -INSTANTIATE_TEST_CASE_P(MergeMulTest, MatchingInstructionFoldingTest, +INSTANTIATE_TEST_SUITE_P(MergeMulTest, MatchingInstructionFoldingTest, ::testing::Values( // Test case 0: fold consecutive fmuls // (x * 3.0) * 2.0 = x * 6.0 @@ -4845,7 +4845,7 @@ INSTANTIATE_TEST_CASE_P(MergeMulTest, MatchingInstructionFoldingTest, 5, true) )); -INSTANTIATE_TEST_CASE_P(MergeDivTest, MatchingInstructionFoldingTest, +INSTANTIATE_TEST_SUITE_P(MergeDivTest, MatchingInstructionFoldingTest, ::testing::Values( // Test case 0: merge consecutive fdiv // 4.0 / (2.0 / x) = 2.0 * x @@ -5091,7 +5091,7 @@ INSTANTIATE_TEST_CASE_P(MergeDivTest, MatchingInstructionFoldingTest, 5, true) )); -INSTANTIATE_TEST_CASE_P(MergeAddTest, MatchingInstructionFoldingTest, +INSTANTIATE_TEST_SUITE_P(MergeAddTest, MatchingInstructionFoldingTest, ::testing::Values( // Test case 0: merge add of negate // (-x) + 2 = 2 - x @@ -5299,7 +5299,7 @@ INSTANTIATE_TEST_CASE_P(MergeAddTest, MatchingInstructionFoldingTest, 4, true) )); -INSTANTIATE_TEST_CASE_P(MergeSubTest, MatchingInstructionFoldingTest, +INSTANTIATE_TEST_SUITE_P(MergeSubTest, MatchingInstructionFoldingTest, ::testing::Values( // Test case 0: merge sub of negate // (-x) - 2 = -2 - x @@ -5524,7 +5524,7 @@ INSTANTIATE_TEST_CASE_P(MergeSubTest, MatchingInstructionFoldingTest, 4, true) )); -INSTANTIATE_TEST_CASE_P(SelectFoldingTest, MatchingInstructionFoldingTest, +INSTANTIATE_TEST_SUITE_P(SelectFoldingTest, MatchingInstructionFoldingTest, ::testing::Values( // Test case 0: Fold select with the same values for both sides InstructionFoldingCase( @@ -5632,7 +5632,7 @@ INSTANTIATE_TEST_CASE_P(SelectFoldingTest, MatchingInstructionFoldingTest, 4, true) )); -INSTANTIATE_TEST_CASE_P(CompositeExtractMatchingTest, MatchingInstructionFoldingTest, +INSTANTIATE_TEST_SUITE_P(CompositeExtractMatchingTest, MatchingInstructionFoldingTest, ::testing::Values( // Test case 0: Extracting from result of consecutive shuffles of differing // size. @@ -5775,7 +5775,7 @@ INSTANTIATE_TEST_CASE_P(CompositeExtractMatchingTest, MatchingInstructionFolding 4, true) )); -INSTANTIATE_TEST_CASE_P(DotProductMatchingTest, MatchingInstructionFoldingTest, +INSTANTIATE_TEST_SUITE_P(DotProductMatchingTest, MatchingInstructionFoldingTest, ::testing::Values( // Test case 0: Using OpDot to extract last element. InstructionFoldingCase( @@ -5891,7 +5891,7 @@ TEST_P(MatchingInstructionWithNoResultFoldingTest, Case) { } } -INSTANTIATE_TEST_CASE_P(StoreMatchingTest, MatchingInstructionWithNoResultFoldingTest, +INSTANTIATE_TEST_SUITE_P(StoreMatchingTest, MatchingInstructionWithNoResultFoldingTest, ::testing::Values( // Test case 0: Remove store of undef. InstructionFoldingCase( @@ -5920,7 +5920,7 @@ INSTANTIATE_TEST_CASE_P(StoreMatchingTest, MatchingInstructionWithNoResultFoldin 0 /* OpStore */, false) )); -INSTANTIATE_TEST_CASE_P(VectorShuffleMatchingTest, MatchingInstructionWithNoResultFoldingTest, +INSTANTIATE_TEST_SUITE_P(VectorShuffleMatchingTest, MatchingInstructionWithNoResultFoldingTest, ::testing::Values( // Test case 0: Basic test 1 InstructionFoldingCase( diff --git a/3rdparty/spirv-tools/test/opt/freeze_spec_const_test.cpp b/3rdparty/spirv-tools/test/opt/freeze_spec_const_test.cpp index 5cc7843b1..e5999cec6 100644 --- a/3rdparty/spirv-tools/test/opt/freeze_spec_const_test.cpp +++ b/3rdparty/spirv-tools/test/opt/freeze_spec_const_test.cpp @@ -47,7 +47,7 @@ TEST_P(FreezeSpecConstantValueTypeTest, PrimaryType) { } // Test each primary type. -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PrimaryTypeSpecConst, FreezeSpecConstantValueTypeTest, ::testing::ValuesIn(std::vector({ // Type declaration, original spec constant definition, expected frozen diff --git a/3rdparty/spirv-tools/test/opt/set_spec_const_default_value_test.cpp b/3rdparty/spirv-tools/test/opt/set_spec_const_default_value_test.cpp index 161674fe0..5e63862e9 100644 --- a/3rdparty/spirv-tools/test/opt/set_spec_const_default_value_test.cpp +++ b/3rdparty/spirv-tools/test/opt/set_spec_const_default_value_test.cpp @@ -50,7 +50,7 @@ TEST_P(DefaultValuesStringParsingTest, TestCase) { } } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ValidString, DefaultValuesStringParsingTest, ::testing::ValuesIn(std::vector{ // 0. empty map @@ -93,7 +93,7 @@ INSTANTIATE_TEST_CASE_P( {"100:1.5e-13", true, SpecIdToValueStrMap{{100, "1.5e-13"}}}, })); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( InvalidString, DefaultValuesStringParsingTest, ::testing::ValuesIn(std::vector{ // 0. missing default value @@ -148,7 +148,7 @@ TEST_P(SetSpecConstantDefaultValueInStringFormParamTest, TestCase) { tc.code, tc.expected, /* skip_nop = */ false, tc.default_values); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ValidCases, SetSpecConstantDefaultValueInStringFormParamTest, ::testing::ValuesIn(std::vector< SetSpecConstantDefaultValueInStringFormTestCase>{ @@ -445,7 +445,7 @@ INSTANTIATE_TEST_CASE_P( }, })); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( InvalidCases, SetSpecConstantDefaultValueInStringFormParamTest, ::testing::ValuesIn(std::vector< SetSpecConstantDefaultValueInStringFormTestCase>{ @@ -610,7 +610,7 @@ TEST_P(SetSpecConstantDefaultValueInBitPatternFormParamTest, TestCase) { tc.code, tc.expected, /* skip_nop = */ false, tc.default_values); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ValidCases, SetSpecConstantDefaultValueInBitPatternFormParamTest, ::testing::ValuesIn(std::vector< SetSpecConstantDefaultValueInBitPatternFormTestCase>{ @@ -937,7 +937,7 @@ INSTANTIATE_TEST_CASE_P( }, })); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( InvalidCases, SetSpecConstantDefaultValueInBitPatternFormParamTest, ::testing::ValuesIn(std::vector< SetSpecConstantDefaultValueInBitPatternFormTestCase>{ diff --git a/3rdparty/spirv-tools/test/opt/strip_debug_info_test.cpp b/3rdparty/spirv-tools/test/opt/strip_debug_info_test.cpp index f40ed382a..25cf7d8ac 100644 --- a/3rdparty/spirv-tools/test/opt/strip_debug_info_test.cpp +++ b/3rdparty/spirv-tools/test/opt/strip_debug_info_test.cpp @@ -89,7 +89,7 @@ TEST_P(StripDebugInfoTest, Kind) { // Test each possible non-line debug instruction. // clang-format off -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SingleKindDebugInst, StripDebugInfoTest, ::testing::ValuesIn(std::vector({ "OpSourceContinued \"I'm a happy shader! Yay! ;)\"", diff --git a/3rdparty/spirv-tools/test/opt/unify_const_test.cpp b/3rdparty/spirv-tools/test/opt/unify_const_test.cpp index 37728cc23..6ed217348 100644 --- a/3rdparty/spirv-tools/test/opt/unify_const_test.cpp +++ b/3rdparty/spirv-tools/test/opt/unify_const_test.cpp @@ -354,8 +354,14 @@ TEST_P(UnifyFrontEndConstantParamTest, TestCase) { Check(expected_builder, test_builder); } -INSTANTIATE_TEST_CASE_P(Case, UnifyFrontEndConstantParamTest, - ::testing::ValuesIn(std::vector({ +INSTANTIATE_TEST_SUITE_P( + Case, UnifyFrontEndConstantParamTest, + :: + testing:: + ValuesIn( + std:: + vector( + { // clang-format off // basic tests for scalar constants { diff --git a/3rdparty/spirv-tools/test/opt/utils_test.cpp b/3rdparty/spirv-tools/test/opt/utils_test.cpp index 9bb82a367..5ce146bbb 100644 --- a/3rdparty/spirv-tools/test/opt/utils_test.cpp +++ b/3rdparty/spirv-tools/test/opt/utils_test.cpp @@ -72,7 +72,7 @@ TEST_P(FindAndReplaceTest, SubstringReplacement) { << " expected string: " << GetParam().expected_str; } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SubstringReplacement, FindAndReplaceTest, ::testing::ValuesIn(std::vector({ // orig string, find substring, replace substring, expected string, diff --git a/3rdparty/spirv-tools/test/reduce/CMakeLists.txt b/3rdparty/spirv-tools/test/reduce/CMakeLists.txt index b1fdaff47..c1c9d7676 100644 --- a/3rdparty/spirv-tools/test/reduce/CMakeLists.txt +++ b/3rdparty/spirv-tools/test/reduce/CMakeLists.txt @@ -13,7 +13,8 @@ # limitations under the License. add_spvtools_unittest(TARGET reduce - SRCS operand_to_constant_test.cpp + SRCS merge_blocks_test.cpp + operand_to_constant_test.cpp operand_to_undef_test.cpp operand_to_dominating_id_test.cpp reduce_test_util.cpp diff --git a/3rdparty/spirv-tools/test/reduce/merge_blocks_test.cpp b/3rdparty/spirv-tools/test/reduce/merge_blocks_test.cpp new file mode 100644 index 000000000..e57578e36 --- /dev/null +++ b/3rdparty/spirv-tools/test/reduce/merge_blocks_test.cpp @@ -0,0 +1,513 @@ +// Copyright (c) 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. + +#include "reduce_test_util.h" +#include "source/opt/build_module.h" +#include "source/reduce/merge_blocks_reduction_opportunity_finder.h" +#include "source/reduce/reduction_opportunity.h" + +namespace spvtools { +namespace reduce { +namespace { + +TEST(MergeBlocksReductionPassTest, BasicCheck) { + std::string shader = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "x" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 1 + %10 = OpConstant %6 2 + %11 = OpConstant %6 3 + %12 = OpConstant %6 4 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + OpBranch %13 + %13 = OpLabel + OpStore %8 %9 + OpBranch %14 + %14 = OpLabel + OpStore %8 %10 + OpBranch %15 + %15 = OpLabel + OpStore %8 %11 + OpBranch %16 + %16 = OpLabel + OpStore %8 %12 + OpBranch %17 + %17 = OpLabel + OpReturn + OpFunctionEnd + )"; + const auto env = SPV_ENV_UNIVERSAL_1_3; + const auto consumer = nullptr; + const auto context = + BuildModule(env, consumer, shader, kReduceAssembleOption); + const auto ops = + MergeBlocksReductionOpportunityFinder().GetAvailableOpportunities( + context.get()); + ASSERT_EQ(5, ops.size()); + + // Try order 3, 0, 2, 4, 1 + + ASSERT_TRUE(ops[3]->PreconditionHolds()); + ops[3]->TryToApply(); + + std::string after_op_3 = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "x" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 1 + %10 = OpConstant %6 2 + %11 = OpConstant %6 3 + %12 = OpConstant %6 4 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + OpBranch %13 + %13 = OpLabel + OpStore %8 %9 + OpBranch %14 + %14 = OpLabel + OpStore %8 %10 + OpBranch %15 + %15 = OpLabel + OpStore %8 %11 + OpStore %8 %12 + OpBranch %17 + %17 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CheckEqual(env, after_op_3, context.get()); + + ASSERT_TRUE(ops[0]->PreconditionHolds()); + ops[0]->TryToApply(); + + std::string after_op_0 = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "x" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 1 + %10 = OpConstant %6 2 + %11 = OpConstant %6 3 + %12 = OpConstant %6 4 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + OpStore %8 %9 + OpBranch %14 + %14 = OpLabel + OpStore %8 %10 + OpBranch %15 + %15 = OpLabel + OpStore %8 %11 + OpStore %8 %12 + OpBranch %17 + %17 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CheckEqual(env, after_op_0, context.get()); + + ASSERT_TRUE(ops[2]->PreconditionHolds()); + ops[2]->TryToApply(); + + std::string after_op_2 = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "x" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 1 + %10 = OpConstant %6 2 + %11 = OpConstant %6 3 + %12 = OpConstant %6 4 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + OpStore %8 %9 + OpBranch %14 + %14 = OpLabel + OpStore %8 %10 + OpStore %8 %11 + OpStore %8 %12 + OpBranch %17 + %17 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CheckEqual(env, after_op_2, context.get()); + + ASSERT_TRUE(ops[4]->PreconditionHolds()); + ops[4]->TryToApply(); + + std::string after_op_4 = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "x" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 1 + %10 = OpConstant %6 2 + %11 = OpConstant %6 3 + %12 = OpConstant %6 4 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + OpStore %8 %9 + OpBranch %14 + %14 = OpLabel + OpStore %8 %10 + OpStore %8 %11 + OpStore %8 %12 + OpReturn + OpFunctionEnd + )"; + + CheckEqual(env, after_op_4, context.get()); + + ASSERT_TRUE(ops[1]->PreconditionHolds()); + ops[1]->TryToApply(); + + std::string after_op_1 = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "x" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 1 + %10 = OpConstant %6 2 + %11 = OpConstant %6 3 + %12 = OpConstant %6 4 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + OpStore %8 %9 + OpStore %8 %10 + OpStore %8 %11 + OpStore %8 %12 + OpReturn + OpFunctionEnd + )"; + + CheckEqual(env, after_op_1, context.get()); +} + +TEST(MergeBlocksReductionPassTest, Loops) { + std::string shader = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "x" + OpName %10 "i" + OpName %29 "i" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 1 + %11 = OpConstant %6 0 + %18 = OpConstant %6 10 + %19 = OpTypeBool + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpVariable %7 Function + %29 = OpVariable %7 Function + OpStore %8 %9 + OpBranch %45 + %45 = OpLabel + OpStore %10 %11 + OpBranch %12 + %12 = OpLabel + OpLoopMerge %14 %15 None + OpBranch %16 + %16 = OpLabel + %17 = OpLoad %6 %10 + OpBranch %46 + %46 = OpLabel + %20 = OpSLessThan %19 %17 %18 + OpBranchConditional %20 %13 %14 + %13 = OpLabel + %21 = OpLoad %6 %10 + OpBranch %47 + %47 = OpLabel + %22 = OpLoad %6 %8 + %23 = OpIAdd %6 %22 %21 + OpStore %8 %23 + %24 = OpLoad %6 %10 + %25 = OpLoad %6 %8 + %26 = OpIAdd %6 %25 %24 + OpStore %8 %26 + OpBranch %48 + %48 = OpLabel + OpBranch %15 + %15 = OpLabel + %27 = OpLoad %6 %10 + %28 = OpIAdd %6 %27 %9 + OpStore %10 %28 + OpBranch %12 + %14 = OpLabel + OpStore %29 %11 + OpBranch %49 + %49 = OpLabel + OpBranch %30 + %30 = OpLabel + OpLoopMerge %32 %33 None + OpBranch %34 + %34 = OpLabel + %35 = OpLoad %6 %29 + %36 = OpSLessThan %19 %35 %18 + OpBranch %50 + %50 = OpLabel + OpBranchConditional %36 %31 %32 + %31 = OpLabel + %37 = OpLoad %6 %29 + %38 = OpLoad %6 %8 + %39 = OpIAdd %6 %38 %37 + OpStore %8 %39 + %40 = OpLoad %6 %29 + %41 = OpLoad %6 %8 + %42 = OpIAdd %6 %41 %40 + OpStore %8 %42 + OpBranch %33 + %33 = OpLabel + %43 = OpLoad %6 %29 + %44 = OpIAdd %6 %43 %9 + OpBranch %51 + %51 = OpLabel + OpStore %29 %44 + OpBranch %30 + %32 = OpLabel + OpReturn + OpFunctionEnd + )"; + const auto env = SPV_ENV_UNIVERSAL_1_3; + const auto consumer = nullptr; + const auto context = + BuildModule(env, consumer, shader, kReduceAssembleOption); + const auto ops = + MergeBlocksReductionOpportunityFinder().GetAvailableOpportunities( + context.get()); + ASSERT_EQ(11, ops.size()); + + for (auto& ri : ops) { + ASSERT_TRUE(ri->PreconditionHolds()); + ri->TryToApply(); + } + + std::string after = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "x" + OpName %10 "i" + OpName %29 "i" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 1 + %11 = OpConstant %6 0 + %18 = OpConstant %6 10 + %19 = OpTypeBool + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpVariable %7 Function + %29 = OpVariable %7 Function + OpStore %8 %9 + OpStore %10 %11 + OpBranch %12 + %12 = OpLabel + %17 = OpLoad %6 %10 + %20 = OpSLessThan %19 %17 %18 + OpLoopMerge %14 %13 None + OpBranchConditional %20 %13 %14 + %13 = OpLabel + %21 = OpLoad %6 %10 + %22 = OpLoad %6 %8 + %23 = OpIAdd %6 %22 %21 + OpStore %8 %23 + %24 = OpLoad %6 %10 + %25 = OpLoad %6 %8 + %26 = OpIAdd %6 %25 %24 + OpStore %8 %26 + %27 = OpLoad %6 %10 + %28 = OpIAdd %6 %27 %9 + OpStore %10 %28 + OpBranch %12 + %14 = OpLabel + OpStore %29 %11 + OpBranch %30 + %30 = OpLabel + %35 = OpLoad %6 %29 + %36 = OpSLessThan %19 %35 %18 + OpLoopMerge %32 %31 None + OpBranchConditional %36 %31 %32 + %31 = OpLabel + %37 = OpLoad %6 %29 + %38 = OpLoad %6 %8 + %39 = OpIAdd %6 %38 %37 + OpStore %8 %39 + %40 = OpLoad %6 %29 + %41 = OpLoad %6 %8 + %42 = OpIAdd %6 %41 %40 + OpStore %8 %42 + %43 = OpLoad %6 %29 + %44 = OpIAdd %6 %43 %9 + OpStore %29 %44 + OpBranch %30 + %32 = OpLabel + OpReturn + OpFunctionEnd + )"; + + CheckEqual(env, after, context.get()); +} + +TEST(MergeBlocksReductionPassTest, MergeWithOpPhi) { + std::string shader = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "x" + OpName %10 "y" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpVariable %7 Function + OpStore %8 %9 + %11 = OpLoad %6 %8 + OpBranch %12 + %12 = OpLabel + %13 = OpPhi %6 %11 %5 + OpStore %10 %13 + OpReturn + OpFunctionEnd + )"; + + const auto env = SPV_ENV_UNIVERSAL_1_3; + const auto consumer = nullptr; + const auto context = + BuildModule(env, consumer, shader, kReduceAssembleOption); + const auto ops = + MergeBlocksReductionOpportunityFinder().GetAvailableOpportunities( + context.get()); + ASSERT_EQ(1, ops.size()); + + ASSERT_TRUE(ops[0]->PreconditionHolds()); + ops[0]->TryToApply(); + + std::string after = R"( + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint Fragment %4 "main" + OpExecutionMode %4 OriginUpperLeft + OpSource ESSL 310 + OpName %4 "main" + OpName %8 "x" + OpName %10 "y" + %2 = OpTypeVoid + %3 = OpTypeFunction %2 + %6 = OpTypeInt 32 1 + %7 = OpTypePointer Function %6 + %9 = OpConstant %6 1 + %4 = OpFunction %2 None %3 + %5 = OpLabel + %8 = OpVariable %7 Function + %10 = OpVariable %7 Function + OpStore %8 %9 + %11 = OpLoad %6 %8 + OpStore %10 %11 + OpReturn + OpFunctionEnd + )"; + + CheckEqual(env, after, context.get()); +} + +} // namespace +} // namespace reduce +} // namespace spvtools diff --git a/3rdparty/spirv-tools/test/target_env_test.cpp b/3rdparty/spirv-tools/test/target_env_test.cpp index f9624646d..9f80e8345 100644 --- a/3rdparty/spirv-tools/test/target_env_test.cpp +++ b/3rdparty/spirv-tools/test/target_env_test.cpp @@ -45,8 +45,8 @@ TEST_P(TargetEnvTest, ValidSpirvVersion) { ASSERT_THAT(spirv_version, AnyOf(0x10000, 0x10100, 0x10200, 0x10300)); } -INSTANTIATE_TEST_CASE_P(AllTargetEnvs, TargetEnvTest, - ValuesIn(spvtest::AllTargetEnvironments())); +INSTANTIATE_TEST_SUITE_P(AllTargetEnvs, TargetEnvTest, + ValuesIn(spvtest::AllTargetEnvironments())); TEST(GetContextTest, InvalidTargetEnvProducesNull) { // Use a value beyond the last valid enum value. @@ -70,7 +70,7 @@ TEST_P(TargetParseTest, InvalidTargetEnvProducesNull) { EXPECT_THAT(env, Eq(GetParam().env)); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TargetParsing, TargetParseTest, ValuesIn(std::vector{ {"spv1.0", true, SPV_ENV_UNIVERSAL_1_0}, diff --git a/3rdparty/spirv-tools/test/text_literal_test.cpp b/3rdparty/spirv-tools/test/text_literal_test.cpp index 702808931..28e3500de 100644 --- a/3rdparty/spirv-tools/test/text_literal_test.cpp +++ b/3rdparty/spirv-tools/test/text_literal_test.cpp @@ -106,7 +106,7 @@ TEST_P(GoodStringTest, GoodStrings) { EXPECT_EQ(std::get<1>(GetParam()), l.str); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TextLiteral, GoodStringTest, ::testing::ValuesIn(std::vector>{ {R"("-")", "-"}, @@ -121,7 +121,7 @@ INSTANTIATE_TEST_CASE_P( {"\"\xE4\xBA\xB2\"", "\xE4\xBA\xB2"}, {"\"\\\xE4\xBA\xB2\"", "\xE4\xBA\xB2"}, {"\"this \\\" and this \\\\ and \\\xE4\xBA\xB2\"", - "this \" and this \\ and \xE4\xBA\xB2"}}), ); + "this \" and this \\ and \xE4\xBA\xB2"}})); TEST(TextLiteral, StringTooLong) { spv_literal_t l; @@ -230,7 +230,7 @@ TextLiteralCase Make_Bad_Unsigned(uint32_t bitwidth, const char* text) { } // clang-format off -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( DecimalIntegers, IntegerTest, ::testing::ValuesIn(std::vector{ // Check max value and overflow value for 1-bit numbers. @@ -277,7 +277,7 @@ INSTANTIATE_TEST_CASE_P( Make_Ok__Unsigned(64, "18446744073709551615", {0xffffffff, 0xffffffff}), Make_Ok__Signed(64, "-9223372036854775808", {0x00000000, 0x80000000}), - }),); + })); // clang-format on using IntegerLeadingMinusTest = @@ -290,7 +290,7 @@ TEST_P(IntegerLeadingMinusTest, CantHaveLeadingMinusOnUnsigned) { } // clang-format off -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( DecimalAndHexIntegers, IntegerLeadingMinusTest, ::testing::ValuesIn(std::vector{ // Unsigned numbers never allow a leading minus sign. @@ -303,10 +303,10 @@ INSTANTIATE_TEST_CASE_P( Make_Bad_Unsigned(64, "-0"), Make_Bad_Unsigned(64, "-0x0"), Make_Bad_Unsigned(64, "-0x1"), - }),); + })); // clang-format off -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( HexIntegers, IntegerTest, ::testing::ValuesIn(std::vector{ // Check 0x and 0X prefices. @@ -370,7 +370,7 @@ INSTANTIATE_TEST_CASE_P( Make_Ok__Signed(64, "0x8000000000000000", {0x00000000, 0x80000000}), Make_Ok__Unsigned(64, "0x7fffffffffffffff", {0xffffffff, 0x7fffffff}), Make_Ok__Unsigned(64, "0x8000000000000000", {0x00000000, 0x80000000}), - }),); + })); // clang-format on TEST(OverflowIntegerParse, Decimal) { diff --git a/3rdparty/spirv-tools/test/text_to_binary.annotation_test.cpp b/3rdparty/spirv-tools/test/text_to_binary.annotation_test.cpp index 7aec90555..712209e8c 100644 --- a/3rdparty/spirv-tools/test/text_to_binary.annotation_test.cpp +++ b/3rdparty/spirv-tools/test/text_to_binary.annotation_test.cpp @@ -61,7 +61,7 @@ TEST_P(OpDecorateSimpleTest, AnySimpleDecoration) { } #define CASE(NAME) SpvDecoration##NAME, #NAME -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TextToBinaryDecorateSimple, OpDecorateSimpleTest, Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), ValuesIn(std::vector>{ @@ -106,12 +106,12 @@ INSTANTIATE_TEST_CASE_P( {CASE(NoContraction), {}}, {CASE(InputAttachmentIndex), {102}}, {CASE(Alignment), {16}}, - })), ); + }))); -INSTANTIATE_TEST_CASE_P(TextToBinaryDecorateSimpleV11, OpDecorateSimpleTest, - Combine(Values(SPV_ENV_UNIVERSAL_1_1), - Values(EnumCase{ - CASE(MaxByteOffset), {128}})), ); +INSTANTIATE_TEST_SUITE_P(TextToBinaryDecorateSimpleV11, OpDecorateSimpleTest, + Combine(Values(SPV_ENV_UNIVERSAL_1_1), + Values(EnumCase{ + CASE(MaxByteOffset), {128}}))); #undef CASE TEST_F(OpDecorateSimpleTest, WrongDecoration) { @@ -164,7 +164,7 @@ TEST_P(OpDecorateEnumTest, AnyEnumDecoration) { // clang-format off #define CASE(NAME) \ { SpvBuiltIn##NAME, #NAME, SpvDecorationBuiltIn, "BuiltIn" } -INSTANTIATE_TEST_CASE_P(TextToBinaryDecorateBuiltIn, OpDecorateEnumTest, +INSTANTIATE_TEST_SUITE_P(TextToBinaryDecorateBuiltIn, OpDecorateEnumTest, ::testing::ValuesIn(std::vector{ CASE(Position), CASE(PointSize), @@ -209,7 +209,7 @@ INSTANTIATE_TEST_CASE_P(TextToBinaryDecorateBuiltIn, OpDecorateEnumTest, CASE(SubgroupLocalInvocationId), CASE(VertexIndex), CASE(InstanceIndex), - }),); + })); #undef CASE // clang-format on @@ -222,7 +222,7 @@ TEST_F(OpDecorateEnumTest, WrongBuiltIn) { // clang-format off #define CASE(NAME) \ { SpvFunctionParameterAttribute##NAME, #NAME, SpvDecorationFuncParamAttr, "FuncParamAttr" } -INSTANTIATE_TEST_CASE_P(TextToBinaryDecorateFuncParamAttr, OpDecorateEnumTest, +INSTANTIATE_TEST_SUITE_P(TextToBinaryDecorateFuncParamAttr, OpDecorateEnumTest, ::testing::ValuesIn(std::vector{ CASE(Zext), CASE(Sext), @@ -232,7 +232,7 @@ INSTANTIATE_TEST_CASE_P(TextToBinaryDecorateFuncParamAttr, OpDecorateEnumTest, CASE(NoCapture), CASE(NoWrite), CASE(NoReadWrite), - }),); + })); #undef CASE // clang-format on @@ -245,13 +245,13 @@ TEST_F(OpDecorateEnumTest, WrongFuncParamAttr) { // clang-format off #define CASE(NAME) \ { SpvFPRoundingMode##NAME, #NAME, SpvDecorationFPRoundingMode, "FPRoundingMode" } -INSTANTIATE_TEST_CASE_P(TextToBinaryDecorateFPRoundingMode, OpDecorateEnumTest, +INSTANTIATE_TEST_SUITE_P(TextToBinaryDecorateFPRoundingMode, OpDecorateEnumTest, ::testing::ValuesIn(std::vector{ CASE(RTE), CASE(RTZ), CASE(RTP), CASE(RTN), - }),); + })); #undef CASE // clang-format on @@ -268,7 +268,7 @@ TEST_F(OpDecorateEnumTest, WrongFPRoundingMode) { // clang-format off #define CASE(ENUM,NAME) \ { SpvFPFastMathMode##ENUM, #NAME, SpvDecorationFPFastMathMode, "FPFastMathMode" } -INSTANTIATE_TEST_CASE_P(TextToBinaryDecorateFPFastMathMode, OpDecorateEnumTest, +INSTANTIATE_TEST_SUITE_P(TextToBinaryDecorateFPFastMathMode, OpDecorateEnumTest, ::testing::ValuesIn(std::vector{ CASE(MaskNone, None), CASE(NotNaNMask, NotNaN), @@ -276,7 +276,7 @@ INSTANTIATE_TEST_CASE_P(TextToBinaryDecorateFPFastMathMode, OpDecorateEnumTest, CASE(NSZMask, NSZ), CASE(AllowRecipMask, AllowRecip), CASE(FastMask, Fast), - }),); + })); #undef CASE // clang-format on @@ -329,13 +329,13 @@ TEST_P(OpDecorateLinkageTest, AnyLinkageDecoration) { // clang-format off #define CASE(ENUM) SpvLinkageType##ENUM, #ENUM -INSTANTIATE_TEST_CASE_P(TextToBinaryDecorateLinkage, OpDecorateLinkageTest, +INSTANTIATE_TEST_SUITE_P(TextToBinaryDecorateLinkage, OpDecorateLinkageTest, ::testing::ValuesIn(std::vector{ { CASE(Import), "a" }, { CASE(Export), "foo" }, { CASE(Import), "some kind of long name with spaces etc." }, // TODO(dneto): utf-8, escaping, quoting cases. - }),); + })); #undef CASE // clang-format on @@ -423,7 +423,7 @@ TEST_P(OpMemberDecorateSimpleTest, AnySimpleDecoration) { } #define CASE(NAME) SpvDecoration##NAME, #NAME -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TextToBinaryDecorateSimple, OpMemberDecorateSimpleTest, Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), ValuesIn(std::vector>{ @@ -468,12 +468,12 @@ INSTANTIATE_TEST_CASE_P( {CASE(NoContraction), {}}, {CASE(InputAttachmentIndex), {102}}, {CASE(Alignment), {16}}, - })), ); + }))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TextToBinaryDecorateSimpleV11, OpMemberDecorateSimpleTest, Combine(Values(SPV_ENV_UNIVERSAL_1_1), - Values(EnumCase{CASE(MaxByteOffset), {128}})), ); + Values(EnumCase{CASE(MaxByteOffset), {128}}))); #undef CASE TEST_F(OpMemberDecorateSimpleTest, WrongDecoration) { diff --git a/3rdparty/spirv-tools/test/text_to_binary.constant_test.cpp b/3rdparty/spirv-tools/test/text_to_binary.constant_test.cpp index 1a24b528f..6624d410e 100644 --- a/3rdparty/spirv-tools/test/text_to_binary.constant_test.cpp +++ b/3rdparty/spirv-tools/test/text_to_binary.constant_test.cpp @@ -47,7 +47,7 @@ TEST_P(SamplerAddressingModeTest, AnySamplerAddressingMode) { // clang-format off #define CASE(NAME) { SpvSamplerAddressingMode##NAME, #NAME } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TextToBinarySamplerAddressingMode, SamplerAddressingModeTest, ::testing::ValuesIn(std::vector>{ CASE(None), @@ -55,7 +55,7 @@ INSTANTIATE_TEST_CASE_P( CASE(Clamp), CASE(Repeat), CASE(RepeatMirrored), - }),); + })); #undef CASE // clang-format on @@ -79,12 +79,12 @@ TEST_P(SamplerFilterModeTest, AnySamplerFilterMode) { // clang-format off #define CASE(NAME) { SpvSamplerFilterMode##NAME, #NAME} -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TextToBinarySamplerFilterMode, SamplerFilterModeTest, ::testing::ValuesIn(std::vector>{ CASE(Nearest), CASE(Linear), - }),); + })); #undef CASE // clang-format on @@ -114,7 +114,7 @@ TEST_P(OpConstantValidTest, ValidTypes) { } // clang-format off -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TextToBinaryOpConstantValid, OpConstantValidTest, ::testing::ValuesIn(std::vector{ // Check 16 bits @@ -232,7 +232,7 @@ INSTANTIATE_TEST_CASE_P( {"OpTypeInt 64 1", "0x7fffffff", Concatenate({MakeInstruction(SpvOpTypeInt, {1, 64, 1}), MakeInstruction(SpvOpConstant, {1, 2, 0x7fffffffu, 0})})}, - }),); + })); // clang-format on // A test case for checking OpConstant with invalid literals with a leading @@ -255,7 +255,7 @@ TEST_P(OpConstantInvalidLeadingMinusTest, InvalidCase) { } // clang-format off -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TextToBinaryOpConstantInvalidLeadingMinus, OpConstantInvalidLeadingMinusTest, ::testing::ValuesIn(std::vector{ {"OpTypeInt 16 0", "-0"}, @@ -267,7 +267,7 @@ INSTANTIATE_TEST_CASE_P( {"OpTypeInt 64 0", "-0"}, {"OpTypeInt 64 0", "-0x0"}, {"OpTypeInt 64 0", "-1"}, - }),); + })); // clang-format on // A test case for invalid floating point literals. @@ -293,7 +293,7 @@ TEST_P(OpConstantInvalidFloatConstant, Samples) { } // clang-format off -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TextToBinaryInvalidFloatConstant, OpConstantInvalidFloatConstant, ::testing::ValuesIn(std::vector{ {16, "abc"}, @@ -323,7 +323,7 @@ INSTANTIATE_TEST_CASE_P( {64, "++1"}, {32, "1e400"}, // Overflow is an error for 64-bit floats. {32, "-1e400"}, - }),); + })); // clang-format on using OpConstantInvalidTypeTest = @@ -339,7 +339,7 @@ TEST_P(OpConstantInvalidTypeTest, InvalidTypes) { } // clang-format off -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TextToBinaryOpConstantInvalidValidType, OpConstantInvalidTypeTest, ::testing::ValuesIn(std::vector{ {"OpTypeVoid", @@ -364,7 +364,7 @@ INSTANTIATE_TEST_CASE_P( // At least one thing that isn't a type at all "OpNot %a %b" }, - }),); + })); // clang-format on using OpSpecConstantValidTest = @@ -381,7 +381,7 @@ TEST_P(OpSpecConstantValidTest, ValidTypes) { } // clang-format off -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TextToBinaryOpSpecConstantValid, OpSpecConstantValidTest, ::testing::ValuesIn(std::vector{ // Check 16 bits @@ -433,7 +433,7 @@ INSTANTIATE_TEST_CASE_P( {"OpTypeInt 64 1", "-42", Concatenate({MakeInstruction(SpvOpTypeInt, {1, 64, 1}), MakeInstruction(SpvOpSpecConstant, {1, 2, uint32_t(-42), uint32_t(-1)})})}, - }),); + })); // clang-format on using OpSpecConstantInvalidTypeTest = @@ -449,7 +449,7 @@ TEST_P(OpSpecConstantInvalidTypeTest, InvalidTypes) { } // clang-format off -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TextToBinaryOpSpecConstantInvalidValidType, OpSpecConstantInvalidTypeTest, ::testing::ValuesIn(std::vector{ {"OpTypeVoid", @@ -474,14 +474,14 @@ INSTANTIATE_TEST_CASE_P( // At least one thing that isn't a type at all "OpNot %a %b" }, - }),); + })); // clang-format on const int64_t kMaxUnsigned48Bit = (int64_t(1) << 48) - 1; const int64_t kMaxSigned48Bit = (int64_t(1) << 47) - 1; const int64_t kMinSigned48Bit = -kMaxSigned48Bit - 1; -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( OpConstantRoundTrip, RoundTripTest, ::testing::ValuesIn(std::vector{ // 16 bit @@ -522,9 +522,9 @@ INSTANTIATE_TEST_CASE_P( "%1 = OpTypeFloat 64\n%2 = OpConstant %1 0\n", "%1 = OpTypeFloat 64\n%2 = OpConstant %1 1.79767e+308\n", "%1 = OpTypeFloat 64\n%2 = OpConstant %1 -1.79767e+308\n", - }), ); + })); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( OpConstantHalfRoundTrip, RoundTripTest, ::testing::ValuesIn(std::vector{ "%1 = OpTypeFloat 16\n%2 = OpConstant %1 -0x0p+0\n", @@ -557,11 +557,11 @@ INSTANTIATE_TEST_CASE_P( "%1 = OpTypeFloat 16\n%2 = OpConstant %1 -0x1.ffp+16\n", // -nan "%1 = OpTypeFloat 16\n%2 = OpConstant %1 -0x1.ffcp+16\n", // -nan "%1 = OpTypeFloat 16\n%2 = OpConstant %1 -0x1.004p+16\n", // -nan - }), ); + })); // clang-format off // (Clang-format really wants to break up these strings across lines. -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( OpConstantRoundTripNonFinite, RoundTripTest, ::testing::ValuesIn(std::vector{ "%1 = OpTypeFloat 32\n%2 = OpConstant %1 -0x1p+128\n", // -inf @@ -588,10 +588,10 @@ INSTANTIATE_TEST_CASE_P( "%1 = OpTypeFloat 64\n%2 = OpConstant %1 0x1.0000000000001p+1024\n", // -nan "%1 = OpTypeFloat 64\n%2 = OpConstant %1 0x1.00003p+1024\n", // -nan "%1 = OpTypeFloat 64\n%2 = OpConstant %1 0x1.fffffffffffffp+1024\n", // -nan - }),); + })); // clang-format on -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( OpSpecConstantRoundTrip, RoundTripTest, ::testing::ValuesIn(std::vector{ // 16 bit @@ -632,7 +632,7 @@ INSTANTIATE_TEST_CASE_P( "%1 = OpTypeFloat 64\n%2 = OpSpecConstant %1 0\n", "%1 = OpTypeFloat 64\n%2 = OpSpecConstant %1 1.79767e+308\n", "%1 = OpTypeFloat 64\n%2 = OpSpecConstant %1 -1.79767e+308\n", - }), ); + })); // Test OpSpecConstantOp @@ -662,7 +662,7 @@ TEST_P(OpSpecConstantOpTestWithIds, Assembly) { #define CASE4(NAME) { SpvOp##NAME, #NAME, {3, 4, 5, 6} } #define CASE5(NAME) { SpvOp##NAME, #NAME, {3, 4, 5, 6, 7} } #define CASE6(NAME) { SpvOp##NAME, #NAME, {3, 4, 5, 6, 7, 8} } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TextToBinaryOpSpecConstantOp, OpSpecConstantOpTestWithIds, ::testing::ValuesIn(std::vector>{ // Conversion @@ -738,7 +738,7 @@ INSTANTIATE_TEST_CASE_P( CASE2(InBoundsPtrAccessChain), CASE3(InBoundsPtrAccessChain), CASE6(InBoundsPtrAccessChain), - }),); + })); #undef CASE1 #undef CASE2 #undef CASE3 @@ -768,7 +768,7 @@ TEST_P(OpSpecConstantOpTestWithTwoIdsThenLiteralNumbers, Assembly) { } #define CASE(NAME) SpvOp##NAME, #NAME -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TextToBinaryOpSpecConstantOp, OpSpecConstantOpTestWithTwoIdsThenLiteralNumbers, ::testing::ValuesIn(std::vector>{ @@ -783,7 +783,7 @@ INSTANTIATE_TEST_CASE_P( // composite, and then literal indices. {CASE(CompositeInsert), {0}}, {CASE(CompositeInsert), {4, 3, 99, 1}}, - }), ); + })); using OpSpecConstantOpTestWithOneIdThenLiteralNumbers = spvtest::TextToBinaryTestBase<::testing::TestWithParam>>; @@ -806,7 +806,7 @@ TEST_P(OpSpecConstantOpTestWithOneIdThenLiteralNumbers, Assembly) { } #define CASE(NAME) SpvOp##NAME, #NAME -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TextToBinaryOpSpecConstantOp, OpSpecConstantOpTestWithOneIdThenLiteralNumbers, ::testing::ValuesIn(std::vector>{ @@ -814,7 +814,7 @@ INSTANTIATE_TEST_CASE_P( // indices. Let's only test a few. {CASE(CompositeExtract), {0}}, {CASE(CompositeExtract), {0, 99, 42, 16, 17, 12, 19}}, - }), ); + })); // TODO(dneto): OpConstantTrue // TODO(dneto): OpConstantFalse diff --git a/3rdparty/spirv-tools/test/text_to_binary.control_flow_test.cpp b/3rdparty/spirv-tools/test/text_to_binary.control_flow_test.cpp index 07f110884..01cc8e6a3 100644 --- a/3rdparty/spirv-tools/test/text_to_binary.control_flow_test.cpp +++ b/3rdparty/spirv-tools/test/text_to_binary.control_flow_test.cpp @@ -51,12 +51,12 @@ TEST_P(OpSelectionMergeTest, AnySingleSelectionControlMask) { // clang-format off #define CASE(VALUE,NAME) { SpvSelectionControl##VALUE, NAME} -INSTANTIATE_TEST_CASE_P(TextToBinarySelectionMerge, OpSelectionMergeTest, +INSTANTIATE_TEST_SUITE_P(TextToBinarySelectionMerge, OpSelectionMergeTest, ValuesIn(std::vector>{ CASE(MaskNone, "None"), CASE(FlattenMask, "Flatten"), CASE(DontFlattenMask, "DontFlatten"), - }),); + })); #undef CASE // clang-format on @@ -95,7 +95,7 @@ TEST_P(OpLoopMergeTest, AnySingleLoopControlMask) { { \ SpvLoopControl##VALUE, NAME, { PARM } \ } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TextToBinaryLoopMerge, OpLoopMergeTest, Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), ValuesIn(std::vector>{ @@ -104,9 +104,9 @@ INSTANTIATE_TEST_CASE_P( CASE(UnrollMask, "Unroll"), CASE(DontUnrollMask, "DontUnroll"), // clang-format on - })), ); + }))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TextToBinaryLoopMergeV11, OpLoopMergeTest, Combine(Values(SPV_ENV_UNIVERSAL_1_1), ValuesIn(std::vector>{ @@ -116,7 +116,7 @@ INSTANTIATE_TEST_CASE_P( {SpvLoopControlUnrollMask|SpvLoopControlDependencyLengthMask, "DependencyLength|Unroll", {33}}, // clang-format on - })), ); + }))); #undef CASE #undef CASE1 @@ -251,7 +251,7 @@ SwitchTestCase MakeSwitchTestCase(uint32_t integer_width, Concatenate({{2, 3}, encoded_case_value, {4}}))})}}; } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TextToBinaryOpSwitchValid1Word, OpSwitchValidTest, ValuesIn(std::vector({ MakeSwitchTestCase(32, 0, "42", {42}, "100", {100}), @@ -270,10 +270,10 @@ INSTANTIATE_TEST_CASE_P( MakeSwitchTestCase(16, 1, "0x8000", {0xffff8000}, "0x8100", {0xffff8100}), MakeSwitchTestCase(16, 0, "0x8000", {0x00008000}, "0x8100", {0x8100}), - })), ); + }))); // NB: The words LOW ORDER bits show up first. -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TextToBinaryOpSwitchValid2Words, OpSwitchValidTest, ValuesIn(std::vector({ MakeSwitchTestCase(33, 0, "101", {101, 0}, "500", {500, 0}), @@ -291,9 +291,9 @@ INSTANTIATE_TEST_CASE_P( MakeSwitchTestCase(63, 0, "0x500000000", {0, 5}, "12", {12, 0}), MakeSwitchTestCase(64, 0, "0x600000000", {0, 6}, "12", {12, 0}), MakeSwitchTestCase(64, 1, "0x700000123", {0x123, 7}, "12", {12, 0}), - })), ); + }))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( OpSwitchRoundTripUnsignedIntegers, RoundTripTest, ValuesIn(std::vector({ // Unsigned 16-bit. @@ -307,9 +307,9 @@ INSTANTIATE_TEST_CASE_P( // Unsigned 64-bit, three non-default cases. "%1 = OpTypeInt 64 0\n%2 = OpConstant %1 9223372036854775807\n" "OpSwitch %2 %3 100 %4 102 %5 9000000000000000000 %6\n", - })), ); + }))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( OpSwitchRoundTripSignedIntegers, RoundTripTest, ValuesIn(std::vector{ // Signed 16-bit, with two non-default cases @@ -332,7 +332,7 @@ INSTANTIATE_TEST_CASE_P( "OpSwitch %2 %3 100 %4 7000000000 %5 -1000000000000000000 %6\n", "%1 = OpTypeInt 64 1\n%2 = OpConstant %1 -9223372036854775808\n" "OpSwitch %2 %3 100 %4 7000000000 %5 -1000000000000000000 %6\n", - }), ); + })); using OpSwitchInvalidTypeTestCase = spvtest::TextToBinaryTestBase>; @@ -349,7 +349,7 @@ TEST_P(OpSwitchInvalidTypeTestCase, InvalidTypes) { } // clang-format off -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TextToBinaryOpSwitchInvalidTests, OpSwitchInvalidTypeTestCase, ValuesIn(std::vector{ {"OpTypeVoid", @@ -375,7 +375,7 @@ INSTANTIATE_TEST_CASE_P( // At least one thing that isn't a type at all "OpNot %a %b" }, - }),); + })); // clang-format on // TODO(dneto): OpPhi diff --git a/3rdparty/spirv-tools/test/text_to_binary.debug_test.cpp b/3rdparty/spirv-tools/test/text_to_binary.debug_test.cpp index b85650e5e..f9a464586 100644 --- a/3rdparty/spirv-tools/test/text_to_binary.debug_test.cpp +++ b/3rdparty/spirv-tools/test/text_to_binary.debug_test.cpp @@ -73,8 +73,8 @@ TEST_P(OpSourceTest, AnyLanguage) { GetParam().version}))); } -INSTANTIATE_TEST_CASE_P(TextToBinaryTestDebug, OpSourceTest, - ::testing::ValuesIn(kLanguageCases), ); +INSTANTIATE_TEST_SUITE_P(TextToBinaryTestDebug, OpSourceTest, + ::testing::ValuesIn(kLanguageCases)); TEST_F(OpSourceTest, WrongLanguage) { EXPECT_THAT(CompileFailure("OpSource xxyyzz 12345"), @@ -113,9 +113,9 @@ TEST_P(OpSourceContinuedTest, AnyExtension) { } // TODO(dneto): utf-8, quoting, escaping -INSTANTIATE_TEST_CASE_P(TextToBinaryTestDebug, OpSourceContinuedTest, - ::testing::ValuesIn(std::vector{ - "", "foo bar this and that"}), ); +INSTANTIATE_TEST_SUITE_P(TextToBinaryTestDebug, OpSourceContinuedTest, + ::testing::ValuesIn(std::vector{ + "", "foo bar this and that"})); // Test OpSourceExtension @@ -132,9 +132,9 @@ TEST_P(OpSourceExtensionTest, AnyExtension) { } // TODO(dneto): utf-8, quoting, escaping -INSTANTIATE_TEST_CASE_P(TextToBinaryTestDebug, OpSourceExtensionTest, - ::testing::ValuesIn(std::vector{ - "", "foo bar this and that"}), ); +INSTANTIATE_TEST_SUITE_P(TextToBinaryTestDebug, OpSourceExtensionTest, + ::testing::ValuesIn(std::vector{ + "", "foo bar this and that"})); TEST_F(TextToBinaryTest, OpLine) { EXPECT_THAT(CompiledInstructions("OpLine %srcfile 42 99"), @@ -158,9 +158,9 @@ TEST_P(OpStringTest, AnyString) { } // TODO(dneto): utf-8, quoting, escaping -INSTANTIATE_TEST_CASE_P(TextToBinaryTestDebug, OpStringTest, - ::testing::ValuesIn(std::vector{ - "", "foo bar this and that"}), ); +INSTANTIATE_TEST_SUITE_P(TextToBinaryTestDebug, OpStringTest, + ::testing::ValuesIn(std::vector{ + "", "foo bar this and that"})); using OpNameTest = spvtest::TextToBinaryTestBase<::testing::TestWithParam>; @@ -174,8 +174,8 @@ TEST_P(OpNameTest, AnyString) { // UTF-8, quoting, escaping, etc. are covered in the StringLiterals tests in // BinaryToText.Literal.cpp. -INSTANTIATE_TEST_CASE_P(TextToBinaryTestDebug, OpNameTest, - ::testing::Values("", "foo bar this and that"), ); +INSTANTIATE_TEST_SUITE_P(TextToBinaryTestDebug, OpNameTest, + ::testing::Values("", "foo bar this and that")); using OpMemberNameTest = spvtest::TextToBinaryTestBase<::testing::TestWithParam>; @@ -190,9 +190,9 @@ TEST_P(OpMemberNameTest, AnyString) { } // TODO(dneto): utf-8, quoting, escaping -INSTANTIATE_TEST_CASE_P(TextToBinaryTestDebug, OpMemberNameTest, - ::testing::ValuesIn(std::vector{ - "", "foo bar this and that"}), ); +INSTANTIATE_TEST_SUITE_P(TextToBinaryTestDebug, OpMemberNameTest, + ::testing::ValuesIn(std::vector{ + "", "foo bar this and that"})); // TODO(dneto): Parse failures? @@ -207,8 +207,8 @@ TEST_P(OpModuleProcessedTest, AnyString) { Eq(MakeInstruction(SpvOpModuleProcessed, MakeVector(GetParam())))); } -INSTANTIATE_TEST_CASE_P(TextToBinaryTestDebug, OpModuleProcessedTest, - ::testing::Values("", "foo bar this and that"), ); +INSTANTIATE_TEST_SUITE_P(TextToBinaryTestDebug, OpModuleProcessedTest, + ::testing::Values("", "foo bar this and that")); } // namespace } // namespace spvtools diff --git a/3rdparty/spirv-tools/test/text_to_binary.device_side_enqueue_test.cpp b/3rdparty/spirv-tools/test/text_to_binary.device_side_enqueue_test.cpp index 25c100b8e..03d7e7419 100644 --- a/3rdparty/spirv-tools/test/text_to_binary.device_side_enqueue_test.cpp +++ b/3rdparty/spirv-tools/test/text_to_binary.device_side_enqueue_test.cpp @@ -49,7 +49,7 @@ TEST_P(OpEnqueueKernelGood, Sample) { GetParam().local_size_operands))); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TextToBinaryTest, OpEnqueueKernelGood, ::testing::ValuesIn(std::vector{ // Provide IDs for pointer-to-local arguments for the @@ -71,7 +71,7 @@ INSTANTIATE_TEST_CASE_P( {13, 14, 15, 16, 17, 18, 19, 20, 21}}, {"%l0 %l1 %l2 %l3 %l4 %l5 %l6 %l7 %l8 %l9", {13, 14, 15, 16, 17, 18, 19, 20, 21, 22}}, - }), ); + })); // Test some bad parses of OpEnqueueKernel. For other cases, we're relying // on the uniformity of the parsing algorithm. The following two tests, ensure diff --git a/3rdparty/spirv-tools/test/text_to_binary.extension_test.cpp b/3rdparty/spirv-tools/test/text_to_binary.extension_test.cpp index 5c0bf9885..4c315451a 100644 --- a/3rdparty/spirv-tools/test/text_to_binary.extension_test.cpp +++ b/3rdparty/spirv-tools/test/text_to_binary.extension_test.cpp @@ -135,7 +135,7 @@ TEST_P(ExtensionRoundTripTest, Samples) { // SPV_KHR_shader_ballot -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SPV_KHR_shader_ballot, ExtensionRoundTripTest, // We'll get coverage over operand tables by trying the universal // environments, and at least one specific environment. @@ -164,9 +164,9 @@ INSTANTIATE_TEST_CASE_P( {"OpDecorate %1 BuiltIn SubgroupLtMask\n", MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn, SpvBuiltInSubgroupLtMaskKHR})}, - })), ); + }))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( 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. @@ -194,11 +194,11 @@ INSTANTIATE_TEST_CASE_P( {"OpDecorate %1 BuiltIn SubgroupLtMask\n", MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn, SpvBuiltInSubgroupLtMask})}, - })), ); + }))); // The old builtin names (with KHR suffix) still work in the assmebler, and // map to the enums without the KHR. -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( 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. @@ -219,11 +219,11 @@ INSTANTIATE_TEST_CASE_P( {"OpDecorate %1 BuiltIn SubgroupLtMaskKHR\n", MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn, SpvBuiltInSubgroupLtMask})}, - })), ); + }))); // SPV_KHR_shader_draw_parameters -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SPV_KHR_shader_draw_parameters, ExtensionRoundTripTest, // We'll get coverage over operand tables by trying the universal // environments, and at least one specific environment. @@ -241,11 +241,11 @@ INSTANTIATE_TEST_CASE_P( {"OpDecorate %1 BuiltIn DrawIndex\n", MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn, SpvBuiltInDrawIndex})}, - })), ); + }))); // SPV_KHR_subgroup_vote -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SPV_KHR_subgroup_vote, ExtensionRoundTripTest, // We'll get coverage over operand tables by trying the universal // environments, and at least one specific environment. @@ -260,11 +260,11 @@ INSTANTIATE_TEST_CASE_P( MakeInstruction(SpvOpSubgroupAllKHR, {1, 2, 3})}, {"%2 = OpSubgroupAllEqualKHR %1 %3\n", MakeInstruction(SpvOpSubgroupAllEqualKHR, {1, 2, 3})}, - })), ); + }))); // SPV_KHR_16bit_storage -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SPV_KHR_16bit_storage, ExtensionRoundTripTest, // We'll get coverage over operand tables by trying the universal // environments, and at least one specific environment. @@ -289,9 +289,9 @@ INSTANTIATE_TEST_CASE_P( {"OpCapability StorageInputOutput16\n", MakeInstruction(SpvOpCapability, {SpvCapabilityStorageInputOutput16})}, - })), ); + }))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SPV_KHR_16bit_storage_alias_check, ExtensionAssemblyTest, Combine(ValuesIn(CommonVulkanEnvs()), ValuesIn(std::vector{ @@ -303,11 +303,11 @@ INSTANTIATE_TEST_CASE_P( {"OpCapability UniformAndStorageBuffer16BitAccess\n", MakeInstruction(SpvOpCapability, {SpvCapabilityStorageUniform16})}, - })), ); + }))); // SPV_KHR_device_group -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SPV_KHR_device_group, ExtensionRoundTripTest, // We'll get coverage over operand tables by trying the universal // environments, and at least one specific environment. @@ -318,11 +318,11 @@ INSTANTIATE_TEST_CASE_P( {"OpDecorate %1 BuiltIn DeviceIndex\n", MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn, SpvBuiltInDeviceIndex})}, - })), ); + }))); // SPV_KHR_8bit_storage -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SPV_KHR_8bit_storage, ExtensionRoundTripTest, // We'll get coverage over operand tables by trying the universal // environments, and at least one specific environment. @@ -338,11 +338,11 @@ INSTANTIATE_TEST_CASE_P( {"OpCapability StoragePushConstant8\n", MakeInstruction(SpvOpCapability, {SpvCapabilityStoragePushConstant8})}, - })), ); + }))); // SPV_KHR_multiview -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SPV_KHR_multiview, ExtensionRoundTripTest, // We'll get coverage over operand tables by trying the universal // environments, and at least one specific environment. @@ -354,13 +354,13 @@ INSTANTIATE_TEST_CASE_P( {"OpDecorate %1 BuiltIn ViewIndex\n", MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn, SpvBuiltInViewIndex})}, - })), ); + }))); // SPV_AMD_shader_explicit_vertex_parameter #define PREAMBLE \ "%1 = OpExtInstImport \"SPV_AMD_shader_explicit_vertex_parameter\"\n" -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( 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. @@ -374,13 +374,13 @@ INSTANTIATE_TEST_CASE_P( SpvOpExtInstImport, {1}, MakeVector("SPV_AMD_shader_explicit_vertex_parameter")), MakeInstruction(SpvOpExtInst, {2, 3, 1, 1, 4, 5})})}, - })), ); + }))); #undef PREAMBLE // SPV_AMD_shader_trinary_minmax #define PREAMBLE "%1 = OpExtInstImport \"SPV_AMD_shader_trinary_minmax\"\n" -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SPV_AMD_shader_trinary_minmax, ExtensionRoundTripTest, // We'll get coverage over operand tables by trying the universal // environments, and at least one specific environment. @@ -433,13 +433,13 @@ INSTANTIATE_TEST_CASE_P( {MakeInstruction(SpvOpExtInstImport, {1}, MakeVector("SPV_AMD_shader_trinary_minmax")), MakeInstruction(SpvOpExtInst, {2, 3, 1, 9, 4, 5, 6})})}, - })), ); + }))); #undef PREAMBLE // SPV_AMD_gcn_shader #define PREAMBLE "%1 = OpExtInstImport \"SPV_AMD_gcn_shader\"\n" -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SPV_AMD_gcn_shader, ExtensionRoundTripTest, // We'll get coverage over operand tables by trying the universal // environments, and at least one specific environment. @@ -458,13 +458,13 @@ INSTANTIATE_TEST_CASE_P( Concatenate({MakeInstruction(SpvOpExtInstImport, {1}, MakeVector("SPV_AMD_gcn_shader")), MakeInstruction(SpvOpExtInst, {2, 3, 1, 3})})}, - })), ); + }))); #undef PREAMBLE // SPV_AMD_shader_ballot #define PREAMBLE "%1 = OpExtInstImport \"SPV_AMD_shader_ballot\"\n" -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SPV_AMD_shader_ballot, ExtensionRoundTripTest, // We'll get coverage over operand tables by trying the universal // environments, and at least one specific environment. @@ -490,12 +490,12 @@ INSTANTIATE_TEST_CASE_P( Concatenate({MakeInstruction(SpvOpExtInstImport, {1}, MakeVector("SPV_AMD_shader_ballot")), MakeInstruction(SpvOpExtInst, {2, 3, 1, 4, 4})})}, - })), ); + }))); #undef PREAMBLE // SPV_KHR_variable_pointers -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SPV_KHR_variable_pointers, ExtensionRoundTripTest, // We'll get coverage over operand tables by trying the universal // environments, and at least one specific environment. @@ -508,11 +508,11 @@ INSTANTIATE_TEST_CASE_P( {"OpCapability VariablePointersStorageBuffer\n", MakeInstruction(SpvOpCapability, {SpvCapabilityVariablePointersStorageBuffer})}, - })), ); + }))); // SPV_KHR_vulkan_memory_model -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SPV_KHR_vulkan_memory_model, ExtensionRoundTripTest, // We'll get coverage over operand tables by trying the universal // environments, and at least one specific environment. @@ -652,11 +652,11 @@ INSTANTIATE_TEST_CASE_P( // constant integer referenced by Id. There is no token for // them, and so no assembler or disassembler support required. // Similar for Scope ID. - })), ); + }))); // SPV_GOOGLE_decorate_string -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SPV_GOOGLE_decorate_string, ExtensionRoundTripTest, Combine( // We'll get coverage over operand tables by trying the universal @@ -672,11 +672,11 @@ INSTANTIATE_TEST_CASE_P( MakeInstruction(SpvOpMemberDecorateStringGOOGLE, {1, 3, SpvDecorationHlslSemanticGOOGLE}, MakeVector("DEF"))}, - })), ); + }))); // SPV_GOOGLE_hlsl_functionality1 -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SPV_GOOGLE_hlsl_functionality1, ExtensionRoundTripTest, Combine( // We'll get coverage over operand tables by trying the universal @@ -689,11 +689,11 @@ INSTANTIATE_TEST_CASE_P( {"OpDecorateId %1 HlslCounterBufferGOOGLE %2\n", MakeInstruction(SpvOpDecorateId, {1, SpvDecorationHlslCounterBufferGOOGLE, 2})}, - })), ); + }))); // SPV_NV_viewport_array2 -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( 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, @@ -717,11 +717,11 @@ INSTANTIATE_TEST_CASE_P( {"OpDecorate %1 BuiltIn ViewportMaskNV\n", MakeInstruction(SpvOpDecorate, {1, SpvDecorationBuiltIn, SpvBuiltInViewportMaskNV})}, - })), ); + }))); // SPV_NV_shader_subgroup_partitioned -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SPV_NV_shader_subgroup_partitioned, ExtensionRoundTripTest, Combine( Values(SPV_ENV_UNIVERSAL_1_3, SPV_ENV_VULKAN_1_1), @@ -759,11 +759,11 @@ INSTANTIATE_TEST_CASE_P( SpvGroupOperationPartitionedExclusiveScanNV, 4})}, {"%2 = OpGroupIAdd %1 %3 PartitionedExclusiveScanNV %4\n", MakeInstruction(SpvOpGroupIAdd, {1, 2, 3, 8, 4})}, - })), ); + }))); // SPV_EXT_descriptor_indexing -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SPV_EXT_descriptor_indexing, ExtensionRoundTripTest, Combine( Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1, @@ -851,7 +851,7 @@ INSTANTIATE_TEST_CASE_P( MakeInstruction(SpvOpDecorate, {1, SpvDecorationNonUniformEXT})}, {"OpDecorate %1 NonUniformEXT\n", MakeInstruction(SpvOpDecorate, {1, 5300})}, - })), ); + }))); } // namespace } // namespace spvtools diff --git a/3rdparty/spirv-tools/test/text_to_binary.function_test.cpp b/3rdparty/spirv-tools/test/text_to_binary.function_test.cpp index 748461fb1..55a8e6ce6 100644 --- a/3rdparty/spirv-tools/test/text_to_binary.function_test.cpp +++ b/3rdparty/spirv-tools/test/text_to_binary.function_test.cpp @@ -45,14 +45,14 @@ TEST_P(OpFunctionControlTest, AnySingleFunctionControlMask) { // clang-format off #define CASE(VALUE,NAME) { SpvFunctionControl##VALUE, NAME } -INSTANTIATE_TEST_CASE_P(TextToBinaryFunctionTest, OpFunctionControlTest, +INSTANTIATE_TEST_SUITE_P(TextToBinaryFunctionTest, OpFunctionControlTest, ::testing::ValuesIn(std::vector>{ CASE(MaskNone, "None"), CASE(InlineMask, "Inline"), CASE(DontInlineMask, "DontInline"), CASE(PureMask, "Pure"), CASE(ConstMask, "Const"), - }),); + })); #undef CASE // clang-format on diff --git a/3rdparty/spirv-tools/test/text_to_binary.group_test.cpp b/3rdparty/spirv-tools/test/text_to_binary.group_test.cpp index 2f4b76d2f..becc3aa6f 100644 --- a/3rdparty/spirv-tools/test/text_to_binary.group_test.cpp +++ b/3rdparty/spirv-tools/test/text_to_binary.group_test.cpp @@ -44,12 +44,12 @@ TEST_P(GroupOperationTest, AnyGroupOperation) { // clang-format off #define CASE(NAME) { SpvGroupOperation##NAME, #NAME} -INSTANTIATE_TEST_CASE_P(TextToBinaryGroupOperation, GroupOperationTest, +INSTANTIATE_TEST_SUITE_P(TextToBinaryGroupOperation, GroupOperationTest, ::testing::ValuesIn(std::vector>{ CASE(Reduce), CASE(InclusiveScan), CASE(ExclusiveScan), - }),); + })); #undef CASE // clang-format on diff --git a/3rdparty/spirv-tools/test/text_to_binary.image_test.cpp b/3rdparty/spirv-tools/test/text_to_binary.image_test.cpp index c1adedf44..d445369c2 100644 --- a/3rdparty/spirv-tools/test/text_to_binary.image_test.cpp +++ b/3rdparty/spirv-tools/test/text_to_binary.image_test.cpp @@ -50,7 +50,7 @@ TEST_P(ImageOperandsTest, Sample) { } #define MASK(NAME) SpvImageOperands##NAME##Mask -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TextToBinaryImageOperandsAny, ImageOperandsTest, ::testing::ValuesIn(std::vector{ // TODO(dneto): Rev32 adds many more values, and rearranges their @@ -66,10 +66,10 @@ INSTANTIATE_TEST_CASE_P( {" ConstOffsets %5", {MASK(ConstOffsets), 5}}, {" Sample %5", {MASK(Sample), 5}}, {" MinLod %5", {MASK(MinLod), 5}}, - }), ); + })); #undef MASK #define MASK(NAME) static_cast(SpvImageOperands##NAME##Mask) -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TextToBinaryImageOperandsCombination, ImageOperandsTest, ::testing::ValuesIn(std::vector{ // TODO(dneto): Rev32 adds many more values, and rearranges their @@ -95,7 +95,7 @@ INSTANTIATE_TEST_CASE_P( " %5 %6 %7 %8 %9 %10 %11 %12", {MASK(Bias) | MASK(Lod) | MASK(Grad) | MASK(ConstOffset) | MASK(Offset) | MASK(ConstOffsets) | MASK(Sample), - 5, 6, 7, 8, 9, 10, 11, 12}}}), ); + 5, 6, 7, 8, 9, 10, 11, 12}}})); #undef MASK TEST_F(ImageOperandsTest, WrongOperand) { @@ -173,24 +173,24 @@ TEST_P(ImageSparseReadImageOperandsTest, Sample) { } #define MASK(NAME) SpvImageOperands##NAME##Mask -INSTANTIATE_TEST_CASE_P(ImageSparseReadImageOperandsAny, - ImageSparseReadImageOperandsTest, - ::testing::ValuesIn(std::vector{ - // Image operands are optional. - {"", {}}, - // Test each kind, alone. - {" Bias %5", {MASK(Bias), 5}}, - {" Lod %5", {MASK(Lod), 5}}, - {" Grad %5 %6", {MASK(Grad), 5, 6}}, - {" ConstOffset %5", {MASK(ConstOffset), 5}}, - {" Offset %5", {MASK(Offset), 5}}, - {" ConstOffsets %5", {MASK(ConstOffsets), 5}}, - {" Sample %5", {MASK(Sample), 5}}, - {" MinLod %5", {MASK(MinLod), 5}}, - }), ); +INSTANTIATE_TEST_SUITE_P(ImageSparseReadImageOperandsAny, + ImageSparseReadImageOperandsTest, + ::testing::ValuesIn(std::vector{ + // Image operands are optional. + {"", {}}, + // Test each kind, alone. + {" Bias %5", {MASK(Bias), 5}}, + {" Lod %5", {MASK(Lod), 5}}, + {" Grad %5 %6", {MASK(Grad), 5, 6}}, + {" ConstOffset %5", {MASK(ConstOffset), 5}}, + {" Offset %5", {MASK(Offset), 5}}, + {" ConstOffsets %5", {MASK(ConstOffsets), 5}}, + {" Sample %5", {MASK(Sample), 5}}, + {" MinLod %5", {MASK(MinLod), 5}}, + })); #undef MASK #define MASK(NAME) static_cast(SpvImageOperands##NAME##Mask) -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ImageSparseReadImageOperandsCombination, ImageSparseReadImageOperandsTest, ::testing::ValuesIn(std::vector{ // values. @@ -212,7 +212,7 @@ INSTANTIATE_TEST_CASE_P( 5, 6, 7, 8, 9, 10, 11, 12}}, // Don't try the masks reversed, since this is a round trip test, // and the disassembler will sort them. - }), ); + })); #undef MASK TEST_F(OpImageSparseReadTest, InvalidTypeOperand) { diff --git a/3rdparty/spirv-tools/test/text_to_binary.memory_test.cpp b/3rdparty/spirv-tools/test/text_to_binary.memory_test.cpp index ead08e6fd..6d084327e 100644 --- a/3rdparty/spirv-tools/test/text_to_binary.memory_test.cpp +++ b/3rdparty/spirv-tools/test/text_to_binary.memory_test.cpp @@ -45,14 +45,14 @@ TEST_P(MemoryAccessTest, AnySingleMemoryAccessMask) { GetParam().operands()))); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TextToBinaryMemoryAccessTest, MemoryAccessTest, ::testing::ValuesIn(std::vector>{ {SpvMemoryAccessMaskNone, "None", {}}, {SpvMemoryAccessVolatileMask, "Volatile", {}}, {SpvMemoryAccessAlignedMask, "Aligned", {16}}, {SpvMemoryAccessNontemporalMask, "Nontemporal", {}}, - }), ); + })); TEST_F(TextToBinaryTest, CombinedMemoryAccessMask) { const std::string input = "OpStore %ptr %value Volatile|Aligned 16"; @@ -76,7 +76,7 @@ TEST_P(StorageClassTest, AnyStorageClass) { // clang-format off #define CASE(NAME) { SpvStorageClass##NAME, #NAME, {} } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TextToBinaryStorageClassTest, StorageClassTest, ::testing::ValuesIn(std::vector>{ CASE(UniformConstant), @@ -91,7 +91,7 @@ INSTANTIATE_TEST_CASE_P( CASE(PushConstant), CASE(AtomicCounter), CASE(Image), - }),); + })); #undef CASE // clang-format on diff --git a/3rdparty/spirv-tools/test/text_to_binary.mode_setting_test.cpp b/3rdparty/spirv-tools/test/text_to_binary.mode_setting_test.cpp index ed4fa2fb4..d1b69dd5e 100644 --- a/3rdparty/spirv-tools/test/text_to_binary.mode_setting_test.cpp +++ b/3rdparty/spirv-tools/test/text_to_binary.mode_setting_test.cpp @@ -69,7 +69,7 @@ TEST_P(OpMemoryModelTest, AnyMemoryModelCase) { #MEMORY \ } // clang-format off -INSTANTIATE_TEST_CASE_P(TextToBinaryMemoryModel, OpMemoryModelTest, +INSTANTIATE_TEST_SUITE_P(TextToBinaryMemoryModel, OpMemoryModelTest, ValuesIn(std::vector{ // These cases exercise each addressing model, and // each memory model, but not necessarily in @@ -78,7 +78,7 @@ INSTANTIATE_TEST_CASE_P(TextToBinaryMemoryModel, OpMemoryModelTest, CASE(Logical,GLSL450), CASE(Physical32,OpenCL), CASE(Physical64,OpenCL), - }),); + })); #undef CASE // clang-format on @@ -116,7 +116,7 @@ TEST_P(OpEntryPointTest, AnyEntryPointCase) { // clang-format off #define CASE(NAME) SpvExecutionModel##NAME, #NAME -INSTANTIATE_TEST_CASE_P(TextToBinaryEntryPoint, OpEntryPointTest, +INSTANTIATE_TEST_SUITE_P(TextToBinaryEntryPoint, OpEntryPointTest, ValuesIn(std::vector{ { CASE(Vertex), "" }, { CASE(TessellationControl), "my tess" }, @@ -125,7 +125,7 @@ INSTANTIATE_TEST_CASE_P(TextToBinaryEntryPoint, OpEntryPointTest, { CASE(Fragment), "FAT32" }, { CASE(GLCompute), "cubic" }, { CASE(Kernel), "Sanders" }, - }),); + })); #undef CASE // clang-format on @@ -151,7 +151,7 @@ TEST_P(OpExecutionModeTest, AnyExecutionMode) { } #define CASE(NAME) SpvExecutionMode##NAME, #NAME -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TextToBinaryExecutionMode, OpExecutionModeTest, Combine(Values(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_1), ValuesIn(std::vector>{ @@ -188,16 +188,16 @@ INSTANTIATE_TEST_CASE_P( {CASE(OutputTriangleStrip), {}}, {CASE(VecTypeHint), {96}}, {CASE(ContractionOff), {}}, - })), ); + }))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TextToBinaryExecutionModeV11, OpExecutionModeTest, Combine(Values(SPV_ENV_UNIVERSAL_1_1), ValuesIn(std::vector>{ {CASE(Initializer)}, {CASE(Finalizer)}, {CASE(SubgroupSize), {12}}, - {CASE(SubgroupsPerWorkgroup), {64}}})), ); + {CASE(SubgroupsPerWorkgroup), {64}}}))); #undef CASE TEST_F(OpExecutionModeTest, WrongMode) { @@ -224,7 +224,7 @@ TEST_P(OpCapabilityTest, AnyCapability) { // clang-format off #define CASE(NAME) { SpvCapability##NAME, #NAME } -INSTANTIATE_TEST_CASE_P(TextToBinaryCapability, OpCapabilityTest, +INSTANTIATE_TEST_SUITE_P(TextToBinaryCapability, OpCapabilityTest, ValuesIn(std::vector>{ CASE(Matrix), CASE(Shader), @@ -280,7 +280,7 @@ INSTANTIATE_TEST_CASE_P(TextToBinaryCapability, OpCapabilityTest, CASE(DerivativeControl), CASE(InterpolationFunction), CASE(TransformFeedback), - }),); + })); #undef CASE // clang-format on diff --git a/3rdparty/spirv-tools/test/text_to_binary.type_declaration_test.cpp b/3rdparty/spirv-tools/test/text_to_binary.type_declaration_test.cpp index c6f158f29..1589188fd 100644 --- a/3rdparty/spirv-tools/test/text_to_binary.type_declaration_test.cpp +++ b/3rdparty/spirv-tools/test/text_to_binary.type_declaration_test.cpp @@ -48,7 +48,7 @@ TEST_P(DimTest, AnyDim) { // clang-format off #define CASE(NAME) {SpvDim##NAME, #NAME} -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TextToBinaryDim, DimTest, ::testing::ValuesIn(std::vector>{ CASE(1D), @@ -58,7 +58,7 @@ INSTANTIATE_TEST_CASE_P( CASE(Rect), CASE(Buffer), CASE(SubpassData), - }),); + })); #undef CASE // clang-format on @@ -84,7 +84,7 @@ TEST_P(ImageFormatTest, AnyImageFormatAndNoAccessQualifier) { // clang-format off #define CASE(NAME) {SpvImageFormat##NAME, #NAME} -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TextToBinaryImageFormat, ImageFormatTest, ::testing::ValuesIn(std::vector>{ CASE(Unknown), @@ -127,7 +127,7 @@ INSTANTIATE_TEST_CASE_P( CASE(Rg8ui), CASE(R16ui), CASE(R8ui), - }),); + })); #undef CASE // clang-format on @@ -153,13 +153,13 @@ TEST_P(ImageAccessQualifierTest, AnyAccessQualifier) { // clang-format off #define CASE(NAME) {SpvAccessQualifier##NAME, #NAME} -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( AccessQualifier, ImageAccessQualifierTest, ::testing::ValuesIn(std::vector>{ CASE(ReadOnly), CASE(WriteOnly), CASE(ReadWrite), - }),); + })); // clang-format on #undef CASE @@ -178,13 +178,13 @@ TEST_P(OpTypePipeTest, AnyAccessQualifier) { // clang-format off #define CASE(NAME) {SpvAccessQualifier##NAME, #NAME} -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TextToBinaryTypePipe, OpTypePipeTest, ::testing::ValuesIn(std::vector>{ CASE(ReadOnly), CASE(WriteOnly), CASE(ReadWrite), - }),); + })); #undef CASE // clang-format on diff --git a/3rdparty/spirv-tools/test/text_to_binary_test.cpp b/3rdparty/spirv-tools/test/text_to_binary_test.cpp index 4ba37ad4d..57f0a6ce0 100644 --- a/3rdparty/spirv-tools/test/text_to_binary_test.cpp +++ b/3rdparty/spirv-tools/test/text_to_binary_test.cpp @@ -58,7 +58,7 @@ TEST_P(GoodMaskParseTest, GoodMaskExpressions) { spvContextDestroy(context); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ParseMask, GoodMaskParseTest, ::testing::ValuesIn(std::vector{ {SPV_OPERAND_TYPE_FP_FAST_MATH_MODE, 0, "None"}, @@ -87,7 +87,7 @@ INSTANTIATE_TEST_CASE_P( {SPV_OPERAND_TYPE_FUNCTION_CONTROL, 4, "Pure"}, {SPV_OPERAND_TYPE_FUNCTION_CONTROL, 8, "Const"}, {SPV_OPERAND_TYPE_FUNCTION_CONTROL, 0xd, "Inline|Const|Pure"}, - }), ); + })); using BadFPFastMathMaskParseTest = ::testing::TestWithParam; @@ -102,12 +102,12 @@ TEST_P(BadFPFastMathMaskParseTest, BadMaskExpressions) { spvContextDestroy(context); } -INSTANTIATE_TEST_CASE_P(ParseMask, BadFPFastMathMaskParseTest, - ::testing::ValuesIn(std::vector{ - nullptr, "", "NotValidEnum", "|", "NotInf|", - "|NotInf", "NotInf||NotNaN", - "Unroll" // A good word, but for the wrong enum - }), ); +INSTANTIATE_TEST_SUITE_P(ParseMask, BadFPFastMathMaskParseTest, + ::testing::ValuesIn(std::vector{ + nullptr, "", "NotValidEnum", "|", "NotInf|", + "|NotInf", "NotInf||NotNaN", + "Unroll" // A good word, but for the wrong enum + })); TEST_F(TextToBinaryTest, InvalidText) { ASSERT_EQ(SPV_ERROR_INVALID_TEXT, @@ -197,7 +197,7 @@ TEST_P(TextToBinaryFloatValueTest, Samples) { {1, 2, GetParam().second})}))); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( FloatValues, TextToBinaryFloatValueTest, ::testing::ValuesIn(std::vector>{ {"0.0", 0x00000000}, // +0 @@ -213,7 +213,7 @@ INSTANTIATE_TEST_CASE_P( {"-2.5", 0xc0200000}, {"!0xff800000", 0xff800000}, // -inf {"!0xff800001", 0xff800001}, // NaN - }), ); + })); using TextToBinaryHalfValueTest = spvtest::TextToBinaryTestBase< ::testing::TestWithParam>>; @@ -227,7 +227,7 @@ TEST_P(TextToBinaryHalfValueTest, Samples) { {1, 2, GetParam().second})}))); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( HalfValues, TextToBinaryHalfValueTest, ::testing::ValuesIn(std::vector>{ {"0.0", 0x00000000}, @@ -245,7 +245,7 @@ INSTANTIATE_TEST_CASE_P( {"0x1.8p4", 0x00004e00}, {"0x1.801p4", 0x00004e00}, {"0x1.804p4", 0x00004e01}, - }), ); + })); TEST(CreateContext, InvalidEnvironment) { spv_target_env env; diff --git a/3rdparty/spirv-tools/test/val/CMakeLists.txt b/3rdparty/spirv-tools/test/val/CMakeLists.txt index d478a7d1c..b4fad2879 100644 --- a/3rdparty/spirv-tools/test/val/CMakeLists.txt +++ b/3rdparty/spirv-tools/test/val/CMakeLists.txt @@ -15,6 +15,8 @@ set(VAL_TEST_COMMON_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/../test_fixture.h ${CMAKE_CURRENT_SOURCE_DIR}/../unit_spirv.h + ${CMAKE_CURRENT_SOURCE_DIR}/val_code_generator.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/val_code_generator.h ${CMAKE_CURRENT_SOURCE_DIR}/val_fixtures.h ) @@ -46,6 +48,7 @@ add_spvtools_unittest(TARGET val_limits SRCS val_limits_test.cpp ${VAL_TEST_COMMON_SRCS} LIBS ${SPIRV_TOOLS} + PCH_FILE pch_test_val ) add_spvtools_unittest(TARGET val_ijklmnop diff --git a/3rdparty/spirv-tools/test/val/val_builtins_test.cpp b/3rdparty/spirv-tools/test/val/val_builtins_test.cpp index 81c7b4f73..9971464c5 100644 --- a/3rdparty/spirv-tools/test/val/val_builtins_test.cpp +++ b/3rdparty/spirv-tools/test/val/val_builtins_test.cpp @@ -26,6 +26,7 @@ #include "gmock/gmock.h" #include "source/spirv_target_env.h" #include "test/unit_spirv.h" +#include "test/val/val_code_generator.h" #include "test/val/val_fixtures.h" namespace spvtools { @@ -62,223 +63,6 @@ using ValidateVulkanCombineBuiltInArrayedVariable = spvtest::ValidateBase< using ValidateWebGPUCombineBuiltInArrayedVariable = spvtest::ValidateBase< std::tuple>; -struct EntryPoint { - std::string name; - std::string execution_model; - std::string execution_modes; - std::string body; - std::string interfaces; -}; - -class CodeGenerator { - public: - std::string Build() const; - - std::vector entry_points_; - std::string capabilities_; - std::string extensions_; - std::string memory_model_; - std::string before_types_; - std::string types_; - std::string after_types_; - std::string add_at_the_end_; -}; - -std::string CodeGenerator::Build() const { - std::ostringstream ss; - - ss << capabilities_; - ss << extensions_; - ss << memory_model_; - - for (const EntryPoint& entry_point : entry_points_) { - ss << "OpEntryPoint " << entry_point.execution_model << " %" - << entry_point.name << " \"" << entry_point.name << "\" " - << entry_point.interfaces << "\n"; - } - - for (const EntryPoint& entry_point : entry_points_) { - ss << entry_point.execution_modes << "\n"; - } - - ss << before_types_; - ss << types_; - ss << after_types_; - - for (const EntryPoint& entry_point : entry_points_) { - ss << "\n"; - ss << "%" << entry_point.name << " = OpFunction %void None %func\n"; - ss << "%" << entry_point.name << "_entry = OpLabel\n"; - ss << entry_point.body; - ss << "\nOpReturn\nOpFunctionEnd\n"; - } - - ss << add_at_the_end_; - - return ss.str(); -} - -std::string GetDefaultShaderCapabilities() { - return R"( -OpCapability Shader -OpCapability Geometry -OpCapability Tessellation -OpCapability Float64 -OpCapability Int64 -OpCapability MultiViewport -OpCapability SampleRateShading -)"; -} - -std::string GetWebGPUShaderCapabilities() { - return R"( -OpCapability Shader -OpCapability VulkanMemoryModelKHR -)"; -} - -std::string GetDefaultShaderTypes() { - return R"( -%void = OpTypeVoid -%func = OpTypeFunction %void -%bool = OpTypeBool -%f32 = OpTypeFloat 32 -%f64 = OpTypeFloat 64 -%u32 = OpTypeInt 32 0 -%u64 = OpTypeInt 64 0 -%f32vec2 = OpTypeVector %f32 2 -%f32vec3 = OpTypeVector %f32 3 -%f32vec4 = OpTypeVector %f32 4 -%f64vec2 = OpTypeVector %f64 2 -%f64vec3 = OpTypeVector %f64 3 -%f64vec4 = OpTypeVector %f64 4 -%u32vec2 = OpTypeVector %u32 2 -%u32vec3 = OpTypeVector %u32 3 -%u64vec3 = OpTypeVector %u64 3 -%u32vec4 = OpTypeVector %u32 4 -%u64vec2 = OpTypeVector %u64 2 - -%f32_0 = OpConstant %f32 0 -%f32_1 = OpConstant %f32 1 -%f32_2 = OpConstant %f32 2 -%f32_3 = OpConstant %f32 3 -%f32_4 = OpConstant %f32 4 -%f32_h = OpConstant %f32 0.5 -%f32vec2_01 = OpConstantComposite %f32vec2 %f32_0 %f32_1 -%f32vec2_12 = OpConstantComposite %f32vec2 %f32_1 %f32_2 -%f32vec3_012 = OpConstantComposite %f32vec3 %f32_0 %f32_1 %f32_2 -%f32vec3_123 = OpConstantComposite %f32vec3 %f32_1 %f32_2 %f32_3 -%f32vec4_0123 = OpConstantComposite %f32vec4 %f32_0 %f32_1 %f32_2 %f32_3 -%f32vec4_1234 = OpConstantComposite %f32vec4 %f32_1 %f32_2 %f32_3 %f32_4 - -%f64_0 = OpConstant %f64 0 -%f64_1 = OpConstant %f64 1 -%f64_2 = OpConstant %f64 2 -%f64_3 = OpConstant %f64 3 -%f64vec2_01 = OpConstantComposite %f64vec2 %f64_0 %f64_1 -%f64vec3_012 = OpConstantComposite %f64vec3 %f64_0 %f64_1 %f64_2 -%f64vec4_0123 = OpConstantComposite %f64vec4 %f64_0 %f64_1 %f64_2 %f64_3 - -%u32_0 = OpConstant %u32 0 -%u32_1 = OpConstant %u32 1 -%u32_2 = OpConstant %u32 2 -%u32_3 = OpConstant %u32 3 -%u32_4 = OpConstant %u32 4 - -%u64_0 = OpConstant %u64 0 -%u64_1 = OpConstant %u64 1 -%u64_2 = OpConstant %u64 2 -%u64_3 = OpConstant %u64 3 - -%u32vec2_01 = OpConstantComposite %u32vec2 %u32_0 %u32_1 -%u32vec2_12 = OpConstantComposite %u32vec2 %u32_1 %u32_2 -%u32vec4_0123 = OpConstantComposite %u32vec4 %u32_0 %u32_1 %u32_2 %u32_3 -%u64vec2_01 = OpConstantComposite %u64vec2 %u64_0 %u64_1 - -%u32arr2 = OpTypeArray %u32 %u32_2 -%u32arr3 = OpTypeArray %u32 %u32_3 -%u32arr4 = OpTypeArray %u32 %u32_4 -%u64arr2 = OpTypeArray %u64 %u32_2 -%u64arr3 = OpTypeArray %u64 %u32_3 -%u64arr4 = OpTypeArray %u64 %u32_4 -%f32arr2 = OpTypeArray %f32 %u32_2 -%f32arr3 = OpTypeArray %f32 %u32_3 -%f32arr4 = OpTypeArray %f32 %u32_4 -%f64arr2 = OpTypeArray %f64 %u32_2 -%f64arr3 = OpTypeArray %f64 %u32_3 -%f64arr4 = OpTypeArray %f64 %u32_4 - -%f32vec3arr3 = OpTypeArray %f32vec3 %u32_3 -%f32vec4arr3 = OpTypeArray %f32vec4 %u32_3 -%f64vec4arr3 = OpTypeArray %f64vec4 %u32_3 -)"; -} - -std::string GetWebGPUShaderTypes() { - return R"( -%void = OpTypeVoid -%func = OpTypeFunction %void -%bool = OpTypeBool -%f32 = OpTypeFloat 32 -%u32 = OpTypeInt 32 0 -%f32vec2 = OpTypeVector %f32 2 -%f32vec3 = OpTypeVector %f32 3 -%f32vec4 = OpTypeVector %f32 4 -%u32vec2 = OpTypeVector %u32 2 -%u32vec3 = OpTypeVector %u32 3 -%u32vec4 = OpTypeVector %u32 4 - -%f32_0 = OpConstant %f32 0 -%f32_1 = OpConstant %f32 1 -%f32_2 = OpConstant %f32 2 -%f32_3 = OpConstant %f32 3 -%f32_4 = OpConstant %f32 4 -%f32_h = OpConstant %f32 0.5 -%f32vec2_01 = OpConstantComposite %f32vec2 %f32_0 %f32_1 -%f32vec2_12 = OpConstantComposite %f32vec2 %f32_1 %f32_2 -%f32vec3_012 = OpConstantComposite %f32vec3 %f32_0 %f32_1 %f32_2 -%f32vec3_123 = OpConstantComposite %f32vec3 %f32_1 %f32_2 %f32_3 -%f32vec4_0123 = OpConstantComposite %f32vec4 %f32_0 %f32_1 %f32_2 %f32_3 -%f32vec4_1234 = OpConstantComposite %f32vec4 %f32_1 %f32_2 %f32_3 %f32_4 - -%u32_0 = OpConstant %u32 0 -%u32_1 = OpConstant %u32 1 -%u32_2 = OpConstant %u32 2 -%u32_3 = OpConstant %u32 3 -%u32_4 = OpConstant %u32 4 - -%u32vec2_01 = OpConstantComposite %u32vec2 %u32_0 %u32_1 -%u32vec2_12 = OpConstantComposite %u32vec2 %u32_1 %u32_2 -%u32vec4_0123 = OpConstantComposite %u32vec4 %u32_0 %u32_1 %u32_2 %u32_3 - -%u32arr2 = OpTypeArray %u32 %u32_2 -%u32arr3 = OpTypeArray %u32 %u32_3 -%u32arr4 = OpTypeArray %u32 %u32_4 -%f32arr2 = OpTypeArray %f32 %u32_2 -%f32arr3 = OpTypeArray %f32 %u32_3 -%f32arr4 = OpTypeArray %f32 %u32_4 - -%f32vec3arr3 = OpTypeArray %f32vec3 %u32_3 -%f32vec4arr3 = OpTypeArray %f32vec4 %u32_3 -)"; -} - -CodeGenerator GetDefaultShaderCodeGenerator() { - CodeGenerator generator; - generator.capabilities_ = GetDefaultShaderCapabilities(); - generator.memory_model_ = "OpMemoryModel Logical GLSL450\n"; - generator.types_ = GetDefaultShaderTypes(); - return generator; -} - -CodeGenerator GetWebGPUShaderCodeGenerator() { - CodeGenerator generator; - generator.capabilities_ = GetWebGPUShaderCapabilities(); - generator.memory_model_ = "OpMemoryModel Logical VulkanKHR\n"; - generator.extensions_ = "OpExtension \"SPV_KHR_vulkan_memory_model\"\n"; - generator.types_ = GetWebGPUShaderTypes(); - return generator; -} bool InitializerRequired(spv_target_env env, const char* const storage_class) { return spvIsWebGPUEnv(env) && (strncmp(storage_class, "Output", 6) == 0 || @@ -291,9 +75,9 @@ CodeGenerator GetInMainCodeGenerator(spv_target_env env, const char* const execution_model, const char* const storage_class, const char* const data_type) { - CodeGenerator generator = spvIsWebGPUEnv(env) - ? GetWebGPUShaderCodeGenerator() - : GetDefaultShaderCodeGenerator(); + CodeGenerator generator = + spvIsWebGPUEnv(env) ? CodeGenerator::GetWebGPUShaderCodeGenerator() + : CodeGenerator::GetDefaultShaderCodeGenerator(); generator.before_types_ = "OpMemberDecorate %built_in_type 0 BuiltIn "; generator.before_types_ += built_in; @@ -400,9 +184,9 @@ CodeGenerator GetInFunctionCodeGenerator(spv_target_env env, const char* const execution_model, const char* const storage_class, const char* const data_type) { - CodeGenerator generator = spvIsWebGPUEnv(env) - ? GetWebGPUShaderCodeGenerator() - : GetDefaultShaderCodeGenerator(); + CodeGenerator generator = + spvIsWebGPUEnv(env) ? CodeGenerator::GetWebGPUShaderCodeGenerator() + : CodeGenerator::GetDefaultShaderCodeGenerator(); generator.before_types_ = "OpMemberDecorate %built_in_type 0 BuiltIn "; generator.before_types_ += built_in; @@ -523,9 +307,9 @@ CodeGenerator GetVariableCodeGenerator(spv_target_env env, const char* const execution_model, const char* const storage_class, const char* const data_type) { - CodeGenerator generator = spvIsWebGPUEnv(env) - ? GetWebGPUShaderCodeGenerator() - : GetDefaultShaderCodeGenerator(); + CodeGenerator generator = + spvIsWebGPUEnv(env) ? CodeGenerator::GetWebGPUShaderCodeGenerator() + : CodeGenerator::GetDefaultShaderCodeGenerator(); generator.before_types_ = "OpDecorate %built_in_var BuiltIn "; generator.before_types_ += built_in; @@ -624,25 +408,25 @@ TEST_P(ValidateWebGPUCombineBuiltInExecutionModelDataTypeResult, Variable) { } } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ClipAndCullDistanceOutputSuccess, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("ClipDistance", "CullDistance"), Values("Vertex", "Geometry", "TessellationControl", "TessellationEvaluation"), Values("Output"), Values("%f32arr2", "%f32arr4"), - Values(TestResult())), ); + Values(TestResult()))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ClipAndCullDistanceInputSuccess, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("ClipDistance", "CullDistance"), Values("Fragment", "Geometry", "TessellationControl", "TessellationEvaluation"), Values("Input"), Values("%f32arr2", "%f32arr4"), - Values(TestResult())), ); + Values(TestResult()))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ClipAndCullDistanceFragmentOutput, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("ClipDistance", "CullDistance"), Values("Fragment"), @@ -652,9 +436,9 @@ INSTANTIATE_TEST_CASE_P( "Vulkan spec doesn't allow BuiltIn ClipDistance/CullDistance " "to be used for variables with Output storage class if " "execution model is Fragment.", - "which is called with execution model Fragment."))), ); + "which is called with execution model Fragment.")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( VertexIdAndInstanceIdVertexInput, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("VertexId", "InstanceId"), Values("Vertex"), Values("Input"), @@ -662,9 +446,9 @@ INSTANTIATE_TEST_CASE_P( Values(TestResult( SPV_ERROR_INVALID_DATA, "Vulkan spec doesn't allow BuiltIn VertexId/InstanceId to be " - "used."))), ); + "used.")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ClipAndCullDistanceVertexInput, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("ClipDistance", "CullDistance"), Values("Vertex"), @@ -674,9 +458,9 @@ INSTANTIATE_TEST_CASE_P( "Vulkan spec doesn't allow BuiltIn ClipDistance/CullDistance " "to be used for variables with Input storage class if " "execution model is Vertex.", - "which is called with execution model Vertex."))), ); + "which is called with execution model Vertex.")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ClipAndCullInvalidExecutionModel, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("ClipDistance", "CullDistance"), Values("GLCompute"), @@ -684,41 +468,46 @@ INSTANTIATE_TEST_CASE_P( Values(TestResult( SPV_ERROR_INVALID_DATA, "to be used only with Fragment, Vertex, TessellationControl, " - "TessellationEvaluation or Geometry execution models"))), ); + "TessellationEvaluation or Geometry execution models")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ClipAndCullDistanceNotArray, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("ClipDistance", "CullDistance"), Values("Fragment"), Values("Input"), Values("%f32vec2", "%f32vec4", "%f32"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 32-bit float array", - "is not an array"))), ); + "is not an array")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ClipAndCullDistanceNotFloatArray, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("ClipDistance", "CullDistance"), Values("Fragment"), Values("Input"), Values("%u32arr2", "%u64arr4"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 32-bit float array", - "components are not float scalar"))), ); + "components are not float scalar")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ClipAndCullDistanceNotF32Array, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("ClipDistance", "CullDistance"), Values("Fragment"), Values("Input"), Values("%f64arr2", "%f64arr4"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 32-bit float array", - "has components with bit width 64"))), ); + "has components with bit width 64")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( FragCoordSuccess, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("FragCoord"), Values("Fragment"), Values("Input"), - Values("%f32vec4"), Values(TestResult())), ); + Values("%f32vec4"), Values(TestResult()))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( + FragCoordSuccess, ValidateWebGPUCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("FragCoord"), Values("Fragment"), Values("Input"), + Values("%f32vec4"), Values(TestResult()))); + +INSTANTIATE_TEST_SUITE_P( FragCoordNotFragment, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine( @@ -727,50 +516,91 @@ INSTANTIATE_TEST_CASE_P( "TessellationEvaluation"), Values("Input"), Values("%f32vec4"), Values(TestResult(SPV_ERROR_INVALID_DATA, - "to be used only with Fragment execution model"))), ); + "to be used only with Fragment execution model")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( + FragCoordNotFragment, + ValidateWebGPUCombineBuiltInExecutionModelDataTypeResult, + Combine( + Values("FragCoord"), Values("Vertex", "GLCompute"), Values("Input"), + Values("%f32vec4"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "to be used only with Fragment execution model")))); + +INSTANTIATE_TEST_SUITE_P( FragCoordNotInput, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("FragCoord"), Values("Fragment"), Values("Output"), Values("%f32vec4"), Values(TestResult( SPV_ERROR_INVALID_DATA, "to be only used for variables with Input storage class", - "uses storage class Output"))), ); + "uses storage class Output")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( + FragCoordNotInput, ValidateWebGPUCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("FragCoord"), Values("Fragment"), Values("Output"), + Values("%f32vec4"), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "to be only used for variables with Input storage class", + "uses storage class Output")))); + +INSTANTIATE_TEST_SUITE_P( FragCoordNotFloatVector, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("FragCoord"), Values("Fragment"), Values("Input"), Values("%f32arr4", "%u32vec4"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 4-component 32-bit float vector", - "is not a float vector"))), ); + "is not a float vector")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( + FragCoordNotFloatVector, + ValidateWebGPUCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("FragCoord"), Values("Fragment"), Values("Input"), + Values("%f32arr4", "%u32vec4"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 4-component 32-bit float vector", + "is not a float vector")))); + +INSTANTIATE_TEST_SUITE_P( FragCoordNotFloatVec4, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("FragCoord"), Values("Fragment"), Values("Input"), Values("%f32vec3"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 4-component 32-bit float vector", - "has 3 components"))), ); + "has 3 components")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( + FragCoordNotFloatVec4, + ValidateWebGPUCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("FragCoord"), Values("Fragment"), Values("Input"), + Values("%f32vec3"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 4-component 32-bit float vector", + "has 3 components")))); + +INSTANTIATE_TEST_SUITE_P( FragCoordNotF32Vec4, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("FragCoord"), Values("Fragment"), Values("Input"), Values("%f64vec4"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 4-component 32-bit float vector", - "has components with bit width 64"))), ); + "has components with bit width 64")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( FragDepthSuccess, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("FragDepth"), Values("Fragment"), Values("Output"), - Values("%f32"), Values(TestResult())), ); + Values("%f32"), Values(TestResult()))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( + FragDepthSuccess, ValidateWebGPUCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("FragDepth"), Values("Fragment"), Values("Output"), + Values("%f32"), Values(TestResult()))); + +INSTANTIATE_TEST_SUITE_P( FragDepthNotFragment, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine( @@ -779,9 +609,18 @@ INSTANTIATE_TEST_CASE_P( "TessellationEvaluation"), Values("Output"), Values("%f32"), Values(TestResult(SPV_ERROR_INVALID_DATA, - "to be used only with Fragment execution model"))), ); + "to be used only with Fragment execution model")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( + FragDepthNotFragment, + ValidateWebGPUCombineBuiltInExecutionModelDataTypeResult, + Combine( + Values("FragDepth"), Values("Vertex", "GLCompute"), Values("Output"), + Values("%f32"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "to be used only with Fragment execution model")))); + +INSTANTIATE_TEST_SUITE_P( FragDepthNotOutput, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("FragDepth"), Values("Fragment"), Values("Input"), @@ -789,32 +628,57 @@ INSTANTIATE_TEST_CASE_P( Values(TestResult( SPV_ERROR_INVALID_DATA, "to be only used for variables with Output storage class", - "uses storage class Input"))), ); + "uses storage class Input")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( + FragDepthNotOutput, + ValidateWebGPUCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("FragDepth"), Values("Fragment"), Values("Input"), + Values("%f32"), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "to be only used for variables with Output storage class", + "uses storage class Input")))); + +INSTANTIATE_TEST_SUITE_P( FragDepthNotFloatScalar, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("FragDepth"), Values("Fragment"), Values("Output"), Values("%f32vec4", "%u32"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 32-bit float scalar", - "is not a float scalar"))), ); + "is not a float scalar")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( + FragDepthNotFloatScalar, + ValidateWebGPUCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("FragDepth"), Values("Fragment"), Values("Output"), + Values("%f32vec4", "%u32"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 32-bit float scalar", + "is not a float scalar")))); + +INSTANTIATE_TEST_SUITE_P( FragDepthNotF32, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("FragDepth"), Values("Fragment"), Values("Output"), Values("%f64"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 32-bit float scalar", - "has bit width 64"))), ); + "has bit width 64")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( FrontFacingAndHelperInvocationSuccess, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("FrontFacing", "HelperInvocation"), Values("Fragment"), - Values("Input"), Values("%bool"), Values(TestResult())), ); + Values("Input"), Values("%bool"), Values(TestResult()))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( + FrontFacingSuccess, + ValidateWebGPUCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("FrontFacing"), Values("Fragment"), Values("Input"), + Values("%bool"), Values(TestResult()))); + +INSTANTIATE_TEST_SUITE_P( FrontFacingAndHelperInvocationNotFragment, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine( @@ -823,9 +687,18 @@ INSTANTIATE_TEST_CASE_P( "TessellationEvaluation"), Values("Input"), Values("%bool"), Values(TestResult(SPV_ERROR_INVALID_DATA, - "to be used only with Fragment execution model"))), ); + "to be used only with Fragment execution model")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( + FrontFacingNotFragment, + ValidateWebGPUCombineBuiltInExecutionModelDataTypeResult, + Combine( + Values("FrontFacing"), Values("Vertex", "GLCompute"), Values("Input"), + Values("%bool"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "to be used only with Fragment execution model")))); + +INSTANTIATE_TEST_SUITE_P( FrontFacingAndHelperInvocationNotInput, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("FrontFacing", "HelperInvocation"), Values("Fragment"), @@ -833,38 +706,73 @@ INSTANTIATE_TEST_CASE_P( Values(TestResult( SPV_ERROR_INVALID_DATA, "to be only used for variables with Input storage class", - "uses storage class Output"))), ); + "uses storage class Output")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( + FrontFacingNotInput, + ValidateWebGPUCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("FrontFacing"), Values("Fragment"), Values("Output"), + Values("%bool"), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "to be only used for variables with Input storage class", + "uses storage class Output")))); + +INSTANTIATE_TEST_SUITE_P( FrontFacingAndHelperInvocationNotBool, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("FrontFacing", "HelperInvocation"), Values("Fragment"), Values("Input"), Values("%f32", "%u32"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a bool scalar", - "is not a bool scalar"))), ); + "is not a bool scalar")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( + FrontFacingNotBool, + ValidateWebGPUCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("FrontFacing"), Values("Fragment"), Values("Input"), + Values("%f32", "%u32"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a bool scalar", + "is not a bool scalar")))); + +INSTANTIATE_TEST_SUITE_P( ComputeShaderInputInt32Vec3Success, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("GlobalInvocationId", "LocalInvocationId", "NumWorkgroups", "WorkgroupId"), Values("GLCompute"), Values("Input"), Values("%u32vec3"), - Values(TestResult())), ); + Values(TestResult()))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( + ComputeShaderInputInt32Vec3Success, + ValidateWebGPUCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("GlobalInvocationId", "LocalInvocationId", "NumWorkgroups"), + Values("GLCompute"), Values("Input"), Values("%u32vec3"), + Values(TestResult()))); + +INSTANTIATE_TEST_SUITE_P( ComputeShaderInputInt32Vec3NotGLCompute, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, - Combine(Values("GlobalInvocationId", "LocalInvocationId", "NumWorkgroups", - "WorkgroupId"), - Values("Vertex", "Fragment", "Geometry", "TessellationControl", - "TessellationEvaluation"), - Values("Input"), Values("%u32vec3"), - Values(TestResult( - SPV_ERROR_INVALID_DATA, - "to be used only with GLCompute execution model"))), ); + Combine( + Values("GlobalInvocationId", "LocalInvocationId", "NumWorkgroups", + "WorkgroupId"), + Values("Vertex", "Fragment", "Geometry", "TessellationControl", + "TessellationEvaluation"), + Values("Input"), Values("%u32vec3"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "to be used only with GLCompute execution model")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( + ComputeShaderInputInt32Vec3NotGLCompute, + ValidateWebGPUCombineBuiltInExecutionModelDataTypeResult, + Combine( + Values("GlobalInvocationId", "LocalInvocationId", "NumWorkgroups"), + Values("Vertex", "Fragment"), Values("Input"), Values("%u32vec3"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "to be used only with GLCompute execution model")))); + +INSTANTIATE_TEST_SUITE_P( ComputeShaderInputInt32Vec3NotInput, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("GlobalInvocationId", "LocalInvocationId", "NumWorkgroups", @@ -873,9 +781,19 @@ INSTANTIATE_TEST_CASE_P( Values(TestResult( SPV_ERROR_INVALID_DATA, "to be only used for variables with Input storage class", - "uses storage class Output"))), ); + "uses storage class Output")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( + ComputeShaderInputInt32Vec3NotInput, + ValidateWebGPUCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("GlobalInvocationId", "LocalInvocationId", "NumWorkgroups"), + Values("GLCompute"), Values("Output"), Values("%u32vec3"), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "to be only used for variables with Input storage class", + "uses storage class Output")))); + +INSTANTIATE_TEST_SUITE_P( ComputeShaderInputInt32Vec3NotIntVector, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("GlobalInvocationId", "LocalInvocationId", "NumWorkgroups", @@ -884,9 +802,19 @@ INSTANTIATE_TEST_CASE_P( Values("%u32arr3", "%f32vec3"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 3-component 32-bit int vector", - "is not an int vector"))), ); + "is not an int vector")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( + ComputeShaderInputInt32Vec3NotIntVector, + ValidateWebGPUCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("GlobalInvocationId", "LocalInvocationId", "NumWorkgroups"), + Values("GLCompute"), Values("Input"), + Values("%u32arr3", "%f32vec3"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 3-component 32-bit int vector", + "is not an int vector")))); + +INSTANTIATE_TEST_SUITE_P( ComputeShaderInputInt32Vec3NotIntVec3, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("GlobalInvocationId", "LocalInvocationId", "NumWorkgroups", @@ -894,9 +822,18 @@ INSTANTIATE_TEST_CASE_P( Values("GLCompute"), Values("Input"), Values("%u32vec4"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 3-component 32-bit int vector", - "has 4 components"))), ); + "has 4 components")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( + ComputeShaderInputInt32Vec3NotIntVec3, + ValidateWebGPUCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("GlobalInvocationId", "LocalInvocationId", "NumWorkgroups"), + Values("GLCompute"), Values("Input"), Values("%u32vec4"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 3-component 32-bit int vector", + "has 4 components")))); + +INSTANTIATE_TEST_SUITE_P( ComputeShaderInputInt32Vec3NotInt32Vec, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("GlobalInvocationId", "LocalInvocationId", "NumWorkgroups", @@ -904,15 +841,15 @@ INSTANTIATE_TEST_CASE_P( Values("GLCompute"), Values("Input"), Values("%u64vec3"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 3-component 32-bit int vector", - "has components with bit width 64"))), ); + "has components with bit width 64")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( InvocationIdSuccess, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("InvocationId"), Values("Geometry", "TessellationControl"), - Values("Input"), Values("%u32"), Values(TestResult())), ); + Values("Input"), Values("%u32"), Values(TestResult()))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( InvocationIdInvalidExecutionModel, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("InvocationId"), @@ -920,9 +857,9 @@ INSTANTIATE_TEST_CASE_P( Values("Input"), Values("%u32"), Values(TestResult(SPV_ERROR_INVALID_DATA, "to be used only with TessellationControl or " - "Geometry execution models"))), ); + "Geometry execution models")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( InvocationIdNotInput, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("InvocationId"), Values("Geometry", "TessellationControl"), @@ -930,44 +867,57 @@ INSTANTIATE_TEST_CASE_P( Values(TestResult( SPV_ERROR_INVALID_DATA, "to be only used for variables with Input storage class", - "uses storage class Output"))), ); + "uses storage class Output")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( InvocationIdNotIntScalar, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("InvocationId"), Values("Geometry", "TessellationControl"), Values("Input"), Values("%f32", "%u32vec3"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 32-bit int scalar", - "is not an int scalar"))), ); + "is not an int scalar")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( InvocationIdNotInt32, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("InvocationId"), Values("Geometry", "TessellationControl"), Values("Input"), Values("%u64"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 32-bit int scalar", - "has bit width 64"))), ); + "has bit width 64")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( InstanceIndexSuccess, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("InstanceIndex"), Values("Vertex"), Values("Input"), - Values("%u32"), Values(TestResult())), ); + Values("%u32"), Values(TestResult()))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( + InstanceIndexSuccess, + ValidateWebGPUCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("InstanceIndex"), Values("Vertex"), Values("Input"), + Values("%u32"), Values(TestResult()))); + +INSTANTIATE_TEST_SUITE_P( InstanceIndexInvalidExecutionModel, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, - Combine( - Values("InstanceIndex"), - Values("Geometry", "Fragment", "GLCompute", "TessellationControl", - "TessellationEvaluation"), - Values("Input"), Values("%u32"), - Values(TestResult(SPV_ERROR_INVALID_DATA, - "to be used only with Vertex execution model"))), ); + Combine(Values("InstanceIndex"), + Values("Geometry", "Fragment", "GLCompute", "TessellationControl", + "TessellationEvaluation"), + Values("Input"), Values("%u32"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "to be used only with Vertex execution model")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( + InstanceIndexInvalidExecutionModel, + ValidateWebGPUCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("InstanceIndex"), Values("Fragment", "GLCompute"), + Values("Input"), Values("%u32"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "to be used only with Vertex execution model")))); + +INSTANTIATE_TEST_SUITE_P( InstanceIndexNotInput, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("InstanceIndex"), Values("Vertex"), Values("Output"), @@ -975,39 +925,58 @@ INSTANTIATE_TEST_CASE_P( Values(TestResult( SPV_ERROR_INVALID_DATA, "to be only used for variables with Input storage class", - "uses storage class Output"))), ); + "uses storage class Output")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( + InstanceIndexNotInput, + ValidateWebGPUCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("InstanceIndex"), Values("Vertex"), Values("Output"), + Values("%u32"), + Values(TestResult( + SPV_ERROR_INVALID_DATA, + "to be only used for variables with Input storage class", + "uses storage class Output")))); + +INSTANTIATE_TEST_SUITE_P( InstanceIndexNotIntScalar, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("InstanceIndex"), Values("Vertex"), Values("Input"), Values("%f32", "%u32vec3"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 32-bit int scalar", - "is not an int scalar"))), ); + "is not an int scalar")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( + InstanceIndexNotIntScalar, + ValidateWebGPUCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("InstanceIndex"), Values("Vertex"), Values("Input"), + Values("%f32", "%u32vec3"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 32-bit int scalar", + "is not an int scalar")))); + +INSTANTIATE_TEST_SUITE_P( InstanceIndexNotInt32, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("InstanceIndex"), Values("Vertex"), Values("Input"), Values("%u64"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 32-bit int scalar", - "has bit width 64"))), ); + "has bit width 64")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( LayerAndViewportIndexInputSuccess, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("Layer", "ViewportIndex"), Values("Fragment"), - Values("Input"), Values("%u32"), Values(TestResult())), ); + Values("Input"), Values("%u32"), Values(TestResult()))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( LayerAndViewportIndexOutputSuccess, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("Layer", "ViewportIndex"), Values("Geometry"), - Values("Output"), Values("%u32"), Values(TestResult())), ); + Values("Output"), Values("%u32"), Values(TestResult()))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( LayerAndViewportIndexInvalidExecutionModel, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("Layer", "ViewportIndex"), @@ -1016,9 +985,9 @@ INSTANTIATE_TEST_CASE_P( Values(TestResult( SPV_ERROR_INVALID_DATA, "to be used only with Vertex, TessellationEvaluation, " - "Geometry, or Fragment execution models"))), ); + "Geometry, or Fragment execution models")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( LayerAndViewportIndexExecutionModelEnabledByCapability, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("Layer", "ViewportIndex"), @@ -1026,9 +995,9 @@ INSTANTIATE_TEST_CASE_P( Values("%u32"), Values(TestResult( SPV_ERROR_INVALID_DATA, - "requires the ShaderViewportIndexLayerEXT capability"))), ); + "requires the ShaderViewportIndexLayerEXT capability")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( LayerAndViewportIndexFragmentNotInput, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine( @@ -1036,9 +1005,9 @@ INSTANTIATE_TEST_CASE_P( Values("%u32"), Values(TestResult(SPV_ERROR_INVALID_DATA, "Output storage class if execution model is Fragment", - "which is called with execution model Fragment"))), ); + "which is called with execution model Fragment")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( LayerAndViewportIndexGeometryNotOutput, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine( @@ -1048,34 +1017,34 @@ INSTANTIATE_TEST_CASE_P( Values(TestResult(SPV_ERROR_INVALID_DATA, "Input storage class if execution model is Vertex, " "TessellationEvaluation, or Geometry", - "which is called with execution model"))), ); + "which is called with execution model")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( LayerAndViewportIndexNotIntScalar, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("Layer", "ViewportIndex"), Values("Fragment"), Values("Input"), Values("%f32", "%u32vec3"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 32-bit int scalar", - "is not an int scalar"))), ); + "is not an int scalar")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( LayerAndViewportIndexNotInt32, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("Layer", "ViewportIndex"), Values("Fragment"), Values("Input"), Values("%u64"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 32-bit int scalar", - "has bit width 64"))), ); + "has bit width 64")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PatchVerticesSuccess, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("PatchVertices"), Values("TessellationEvaluation", "TessellationControl"), - Values("Input"), Values("%u32"), Values(TestResult())), ); + Values("Input"), Values("%u32"), Values(TestResult()))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PatchVerticesInvalidExecutionModel, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("PatchVertices"), @@ -1083,9 +1052,9 @@ INSTANTIATE_TEST_CASE_P( Values("Input"), Values("%u32"), Values(TestResult(SPV_ERROR_INVALID_DATA, "to be used only with TessellationControl or " - "TessellationEvaluation execution models"))), ); + "TessellationEvaluation execution models")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PatchVerticesNotInput, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("PatchVertices"), @@ -1094,9 +1063,9 @@ INSTANTIATE_TEST_CASE_P( Values(TestResult( SPV_ERROR_INVALID_DATA, "to be only used for variables with Input storage class", - "uses storage class Output"))), ); + "uses storage class Output")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PatchVerticesNotIntScalar, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("PatchVertices"), @@ -1104,9 +1073,9 @@ INSTANTIATE_TEST_CASE_P( Values("Input"), Values("%f32", "%u32vec3"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 32-bit int scalar", - "is not an int scalar"))), ); + "is not an int scalar")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PatchVerticesNotInt32, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("PatchVertices"), @@ -1114,14 +1083,14 @@ INSTANTIATE_TEST_CASE_P( Values("Input"), Values("%u64"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 32-bit int scalar", - "has bit width 64"))), ); + "has bit width 64")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PointCoordSuccess, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("PointCoord"), Values("Fragment"), Values("Input"), - Values("%f32vec2"), Values(TestResult())), ); + Values("%f32vec2"), Values(TestResult()))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PointCoordNotFragment, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine( @@ -1130,9 +1099,9 @@ INSTANTIATE_TEST_CASE_P( "TessellationEvaluation"), Values("Input"), Values("%f32vec2"), Values(TestResult(SPV_ERROR_INVALID_DATA, - "to be used only with Fragment execution model"))), ); + "to be used only with Fragment execution model")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PointCoordNotInput, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("PointCoord"), Values("Fragment"), Values("Output"), @@ -1140,51 +1109,51 @@ INSTANTIATE_TEST_CASE_P( Values(TestResult( SPV_ERROR_INVALID_DATA, "to be only used for variables with Input storage class", - "uses storage class Output"))), ); + "uses storage class Output")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PointCoordNotFloatVector, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("PointCoord"), Values("Fragment"), Values("Input"), Values("%f32arr2", "%u32vec2"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 2-component 32-bit float vector", - "is not a float vector"))), ); + "is not a float vector")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PointCoordNotFloatVec3, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("PointCoord"), Values("Fragment"), Values("Input"), Values("%f32vec3"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 2-component 32-bit float vector", - "has 3 components"))), ); + "has 3 components")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PointCoordNotF32Vec4, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("PointCoord"), Values("Fragment"), Values("Input"), Values("%f64vec2"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 2-component 32-bit float vector", - "has components with bit width 64"))), ); + "has components with bit width 64")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PointSizeOutputSuccess, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("PointSize"), Values("Vertex", "Geometry", "TessellationControl", "TessellationEvaluation"), - Values("Output"), Values("%f32"), Values(TestResult())), ); + Values("Output"), Values("%f32"), Values(TestResult()))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PointSizeInputSuccess, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("PointSize"), Values("Geometry", "TessellationControl", "TessellationEvaluation"), - Values("Input"), Values("%f32"), Values(TestResult())), ); + Values("Input"), Values("%f32"), Values(TestResult()))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PointSizeVertexInput, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("PointSize"), Values("Vertex"), Values("Input"), @@ -1194,9 +1163,9 @@ INSTANTIATE_TEST_CASE_P( "Vulkan spec doesn't allow BuiltIn PointSize " "to be used for variables with Input storage class if " "execution model is Vertex.", - "which is called with execution model Vertex."))), ); + "which is called with execution model Vertex.")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PointSizeInvalidExecutionModel, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("PointSize"), Values("GLCompute", "Fragment"), @@ -1204,56 +1173,56 @@ INSTANTIATE_TEST_CASE_P( Values(TestResult( SPV_ERROR_INVALID_DATA, "to be used only with Vertex, TessellationControl, " - "TessellationEvaluation or Geometry execution models"))), ); + "TessellationEvaluation or Geometry execution models")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PointSizeNotFloatScalar, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("PointSize"), Values("Vertex"), Values("Output"), Values("%f32vec4", "%u32"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 32-bit float scalar", - "is not a float scalar"))), ); + "is not a float scalar")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PointSizeNotF32, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("PointSize"), Values("Vertex"), Values("Output"), Values("%f64"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 32-bit float scalar", - "has bit width 64"))), ); + "has bit width 64")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PositionOutputSuccess, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("Position"), Values("Vertex", "Geometry", "TessellationControl", "TessellationEvaluation"), - Values("Output"), Values("%f32vec4"), Values(TestResult())), ); + Values("Output"), Values("%f32vec4"), Values(TestResult()))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PositionOutputSuccess, ValidateWebGPUCombineBuiltInExecutionModelDataTypeResult, Combine(Values("Position"), Values("Vertex"), Values("Output"), - Values("%f32vec4"), Values(TestResult())), ); + Values("%f32vec4"), Values(TestResult()))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PositionOutputFailure, ValidateWebGPUCombineBuiltInExecutionModelDataTypeResult, Combine(Values("Position"), Values("Fragment", "GLCompute"), Values("Output"), Values("%f32vec4"), Values(TestResult(SPV_ERROR_INVALID_DATA, "WebGPU spec allows BuiltIn Position to be used " - "only with the Vertex execution model."))), ); + "only with the Vertex execution model.")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PositionInputSuccess, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("Position"), Values("Geometry", "TessellationControl", "TessellationEvaluation"), - Values("Input"), Values("%f32vec4"), Values(TestResult())), ); + Values("Input"), Values("%f32vec4"), Values(TestResult()))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PositionInputFailure, ValidateWebGPUCombineBuiltInExecutionModelDataTypeResult, Combine( @@ -1261,9 +1230,9 @@ INSTANTIATE_TEST_CASE_P( Values("Input"), Values("%f32vec4"), Values(TestResult(SPV_ERROR_INVALID_DATA, "WebGPU spec allows BuiltIn Position to be only used " - "for variables with Output storage class"))), ); + "for variables with Output storage class")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PositionVertexInput, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("Position"), Values("Vertex"), Values("Input"), @@ -1273,9 +1242,9 @@ INSTANTIATE_TEST_CASE_P( "Vulkan spec doesn't allow BuiltIn Position " "to be used for variables with Input storage class if " "execution model is Vertex.", - "which is called with execution model Vertex."))), ); + "which is called with execution model Vertex.")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PositionInvalidExecutionModel, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("Position"), Values("GLCompute", "Fragment"), @@ -1283,68 +1252,68 @@ INSTANTIATE_TEST_CASE_P( Values(TestResult( SPV_ERROR_INVALID_DATA, "to be used only with Vertex, TessellationControl, " - "TessellationEvaluation or Geometry execution models"))), ); + "TessellationEvaluation or Geometry execution models")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PositionNotFloatVector, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("Position"), Values("Geometry"), Values("Input"), Values("%f32arr4", "%u32vec4"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 4-component 32-bit float vector", - "is not a float vector"))), ); + "is not a float vector")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PositionNotFloatVector, ValidateWebGPUCombineBuiltInExecutionModelDataTypeResult, Combine( Values("Position"), Values("Vertex"), Values("Output"), Values("%f32arr4", "%u32vec4"), Values(TestResult(SPV_ERROR_INVALID_DATA, - "needs to be a 4-component 32-bit float vector"))), ); + "needs to be a 4-component 32-bit float vector")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PositionNotFloatVec4, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("Position"), Values("Geometry"), Values("Input"), Values("%f32vec3"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 4-component 32-bit float vector", - "has 3 components"))), ); + "has 3 components")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PositionNotFloatVec4, ValidateWebGPUCombineBuiltInExecutionModelDataTypeResult, Combine( Values("Position"), Values("Vertex"), Values("Output"), Values("%f32vec3"), Values(TestResult(SPV_ERROR_INVALID_DATA, - "needs to be a 4-component 32-bit float vector"))), ); + "needs to be a 4-component 32-bit float vector")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PositionNotF32Vec4, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("Position"), Values("Geometry"), Values("Input"), Values("%f64vec4"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 4-component 32-bit float vector", - "has components with bit width 64"))), ); + "has components with bit width 64")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PrimitiveIdInputSuccess, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("PrimitiveId"), Values("Fragment", "TessellationControl", "TessellationEvaluation", "Geometry"), - Values("Input"), Values("%u32"), Values(TestResult())), ); + Values("Input"), Values("%u32"), Values(TestResult()))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PrimitiveIdOutputSuccess, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("PrimitiveId"), Values("Geometry"), Values("Output"), - Values("%u32"), Values(TestResult())), ); + Values("%u32"), Values(TestResult()))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PrimitiveIdInvalidExecutionModel, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("PrimitiveId"), Values("Vertex", "GLCompute"), @@ -1352,9 +1321,9 @@ INSTANTIATE_TEST_CASE_P( Values(TestResult( SPV_ERROR_INVALID_DATA, "to be used only with Fragment, TessellationControl, " - "TessellationEvaluation or Geometry execution models"))), ); + "TessellationEvaluation or Geometry execution models")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PrimitiveIdFragmentNotInput, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine( @@ -1362,9 +1331,9 @@ INSTANTIATE_TEST_CASE_P( Values("%u32"), Values(TestResult(SPV_ERROR_INVALID_DATA, "Output storage class if execution model is Fragment", - "which is called with execution model Fragment"))), ); + "which is called with execution model Fragment")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PrimitiveIdGeometryNotInput, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("PrimitiveId"), @@ -1373,32 +1342,32 @@ INSTANTIATE_TEST_CASE_P( Values(TestResult( SPV_ERROR_INVALID_DATA, "Output storage class if execution model is Tessellation", - "which is called with execution model Tessellation"))), ); + "which is called with execution model Tessellation")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PrimitiveIdNotIntScalar, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("PrimitiveId"), Values("Fragment"), Values("Input"), Values("%f32", "%u32vec3"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 32-bit int scalar", - "is not an int scalar"))), ); + "is not an int scalar")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PrimitiveIdNotInt32, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("PrimitiveId"), Values("Fragment"), Values("Input"), Values("%u64"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 32-bit int scalar", - "has bit width 64"))), ); + "has bit width 64")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SampleIdSuccess, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("SampleId"), Values("Fragment"), Values("Input"), - Values("%u32"), Values(TestResult())), ); + Values("%u32"), Values(TestResult()))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SampleIdInvalidExecutionModel, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine( @@ -1407,40 +1376,40 @@ INSTANTIATE_TEST_CASE_P( "TessellationEvaluation"), Values("Input"), Values("%u32"), Values(TestResult(SPV_ERROR_INVALID_DATA, - "to be used only with Fragment execution model"))), ); + "to be used only with Fragment execution model")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SampleIdNotInput, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine( Values("SampleId"), Values("Fragment"), Values("Output"), Values("%u32"), Values(TestResult(SPV_ERROR_INVALID_DATA, "Vulkan spec allows BuiltIn SampleId to be only used " - "for variables with Input storage class"))), ); + "for variables with Input storage class")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SampleIdNotIntScalar, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("SampleId"), Values("Fragment"), Values("Input"), Values("%f32", "%u32vec3"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 32-bit int scalar", - "is not an int scalar"))), ); + "is not an int scalar")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SampleIdNotInt32, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("SampleId"), Values("Fragment"), Values("Input"), Values("%u64"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 32-bit int scalar", - "has bit width 64"))), ); + "has bit width 64")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SampleMaskSuccess, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("SampleMask"), Values("Fragment"), Values("Input", "Output"), - Values("%u32arr2", "%u32arr4"), Values(TestResult())), ); + Values("%u32arr2", "%u32arr4"), Values(TestResult()))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SampleMaskInvalidExecutionModel, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine( @@ -1449,9 +1418,9 @@ INSTANTIATE_TEST_CASE_P( "TessellationEvaluation"), Values("Input"), Values("%u32arr2"), Values(TestResult(SPV_ERROR_INVALID_DATA, - "to be used only with Fragment execution model"))), ); + "to be used only with Fragment execution model")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SampleMaskWrongStorageClass, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("SampleMask"), Values("Fragment"), Values("Workgroup"), @@ -1459,42 +1428,42 @@ INSTANTIATE_TEST_CASE_P( Values(TestResult( SPV_ERROR_INVALID_DATA, "Vulkan spec allows BuiltIn SampleMask to be only used for " - "variables with Input or Output storage class"))), ); + "variables with Input or Output storage class")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SampleMaskNotArray, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("SampleMask"), Values("Fragment"), Values("Input"), Values("%f32", "%u32vec3"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 32-bit int array", - "is not an array"))), ); + "is not an array")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SampleMaskNotIntArray, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("SampleMask"), Values("Fragment"), Values("Input"), Values("%f32arr2"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 32-bit int array", - "components are not int scalar"))), ); + "components are not int scalar")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SampleMaskNotInt32Array, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("SampleMask"), Values("Fragment"), Values("Input"), Values("%u64arr2"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 32-bit int array", - "has components with bit width 64"))), ); + "has components with bit width 64")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SamplePositionSuccess, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("SamplePosition"), Values("Fragment"), Values("Input"), - Values("%f32vec2"), Values(TestResult())), ); + Values("%f32vec2"), Values(TestResult()))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SamplePositionNotFragment, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine( @@ -1503,9 +1472,9 @@ INSTANTIATE_TEST_CASE_P( "TessellationEvaluation"), Values("Input"), Values("%f32vec2"), Values(TestResult(SPV_ERROR_INVALID_DATA, - "to be used only with Fragment execution model"))), ); + "to be used only with Fragment execution model")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SamplePositionNotInput, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("SamplePosition"), Values("Fragment"), Values("Output"), @@ -1513,41 +1482,41 @@ INSTANTIATE_TEST_CASE_P( Values(TestResult( SPV_ERROR_INVALID_DATA, "to be only used for variables with Input storage class", - "uses storage class Output"))), ); + "uses storage class Output")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SamplePositionNotFloatVector, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("SamplePosition"), Values("Fragment"), Values("Input"), Values("%f32arr2", "%u32vec4"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 2-component 32-bit float vector", - "is not a float vector"))), ); + "is not a float vector")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SamplePositionNotFloatVec2, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("SamplePosition"), Values("Fragment"), Values("Input"), Values("%f32vec3"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 2-component 32-bit float vector", - "has 3 components"))), ); + "has 3 components")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( SamplePositionNotF32Vec2, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("SamplePosition"), Values("Fragment"), Values("Input"), Values("%f64vec2"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 2-component 32-bit float vector", - "has components with bit width 64"))), ); + "has components with bit width 64")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TessCoordSuccess, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("TessCoord"), Values("TessellationEvaluation"), - Values("Input"), Values("%f32vec3"), Values(TestResult())), ); + Values("Input"), Values("%f32vec3"), Values(TestResult()))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TessCoordNotFragment, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine( @@ -1557,57 +1526,57 @@ INSTANTIATE_TEST_CASE_P( Values("Input"), Values("%f32vec3"), Values(TestResult( SPV_ERROR_INVALID_DATA, - "to be used only with TessellationEvaluation execution model"))), ); + "to be used only with TessellationEvaluation execution model")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TessCoordNotInput, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("TessCoord"), Values("Fragment"), Values("Output"), Values("%f32vec3"), Values(TestResult( SPV_ERROR_INVALID_DATA, "to be only used for variables with Input storage class", - "uses storage class Output"))), ); + "uses storage class Output")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TessCoordNotFloatVector, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("TessCoord"), Values("Fragment"), Values("Input"), Values("%f32arr3", "%u32vec4"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 3-component 32-bit float vector", - "is not a float vector"))), ); + "is not a float vector")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TessCoordNotFloatVec3, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("TessCoord"), Values("Fragment"), Values("Input"), Values("%f32vec2"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 3-component 32-bit float vector", - "has 2 components"))), ); + "has 2 components")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TessCoordNotF32Vec3, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("TessCoord"), Values("Fragment"), Values("Input"), Values("%f64vec3"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 3-component 32-bit float vector", - "has components with bit width 64"))), ); + "has components with bit width 64")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TessLevelOuterTeseInputSuccess, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("TessLevelOuter"), Values("TessellationEvaluation"), - Values("Input"), Values("%f32arr4"), Values(TestResult())), ); + Values("Input"), Values("%f32arr4"), Values(TestResult()))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TessLevelOuterTescOutputSuccess, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("TessLevelOuter"), Values("TessellationControl"), - Values("Output"), Values("%f32arr4"), Values(TestResult())), ); + Values("Output"), Values("%f32arr4"), Values(TestResult()))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TessLevelOuterInvalidExecutionModel, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("TessLevelOuter"), @@ -1615,9 +1584,9 @@ INSTANTIATE_TEST_CASE_P( Values("Input"), Values("%f32arr4"), Values(TestResult(SPV_ERROR_INVALID_DATA, "to be used only with TessellationControl or " - "TessellationEvaluation execution models."))), ); + "TessellationEvaluation execution models.")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TessLevelOuterOutputTese, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("TessLevelOuter"), Values("TessellationEvaluation"), @@ -1626,9 +1595,9 @@ INSTANTIATE_TEST_CASE_P( SPV_ERROR_INVALID_DATA, "Vulkan spec doesn't allow TessLevelOuter/TessLevelInner to be " "used for variables with Output storage class if execution " - "model is TessellationEvaluation."))), ); + "model is TessellationEvaluation.")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TessLevelOuterInputTesc, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("TessLevelOuter"), Values("TessellationControl"), @@ -1637,57 +1606,57 @@ INSTANTIATE_TEST_CASE_P( SPV_ERROR_INVALID_DATA, "Vulkan spec doesn't allow TessLevelOuter/TessLevelInner to be " "used for variables with Input storage class if execution " - "model is TessellationControl."))), ); + "model is TessellationControl.")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TessLevelOuterNotArray, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("TessLevelOuter"), Values("TessellationEvaluation"), Values("Input"), Values("%f32vec4", "%f32"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 4-component 32-bit float array", - "is not an array"))), ); + "is not an array")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TessLevelOuterNotFloatArray, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("TessLevelOuter"), Values("TessellationEvaluation"), Values("Input"), Values("%u32arr4"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 4-component 32-bit float array", - "components are not float scalar"))), ); + "components are not float scalar")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TessLevelOuterNotFloatArr4, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("TessLevelOuter"), Values("TessellationEvaluation"), Values("Input"), Values("%f32arr3"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 4-component 32-bit float array", - "has 3 components"))), ); + "has 3 components")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TessLevelOuterNotF32Arr4, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("TessLevelOuter"), Values("TessellationEvaluation"), Values("Input"), Values("%f64arr4"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 4-component 32-bit float array", - "has components with bit width 64"))), ); + "has components with bit width 64")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TessLevelInnerTeseInputSuccess, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("TessLevelInner"), Values("TessellationEvaluation"), - Values("Input"), Values("%f32arr2"), Values(TestResult())), ); + Values("Input"), Values("%f32arr2"), Values(TestResult()))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TessLevelInnerTescOutputSuccess, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("TessLevelInner"), Values("TessellationControl"), - Values("Output"), Values("%f32arr2"), Values(TestResult())), ); + Values("Output"), Values("%f32arr2"), Values(TestResult()))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TessLevelInnerInvalidExecutionModel, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("TessLevelInner"), @@ -1695,9 +1664,9 @@ INSTANTIATE_TEST_CASE_P( Values("Input"), Values("%f32arr2"), Values(TestResult(SPV_ERROR_INVALID_DATA, "to be used only with TessellationControl or " - "TessellationEvaluation execution models."))), ); + "TessellationEvaluation execution models.")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TessLevelInnerOutputTese, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("TessLevelInner"), Values("TessellationEvaluation"), @@ -1706,9 +1675,9 @@ INSTANTIATE_TEST_CASE_P( SPV_ERROR_INVALID_DATA, "Vulkan spec doesn't allow TessLevelOuter/TessLevelInner to be " "used for variables with Output storage class if execution " - "model is TessellationEvaluation."))), ); + "model is TessellationEvaluation.")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TessLevelInnerInputTesc, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("TessLevelInner"), Values("TessellationControl"), @@ -1717,62 +1686,75 @@ INSTANTIATE_TEST_CASE_P( SPV_ERROR_INVALID_DATA, "Vulkan spec doesn't allow TessLevelOuter/TessLevelInner to be " "used for variables with Input storage class if execution " - "model is TessellationControl."))), ); + "model is TessellationControl.")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TessLevelInnerNotArray, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("TessLevelInner"), Values("TessellationEvaluation"), Values("Input"), Values("%f32vec2", "%f32"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 2-component 32-bit float array", - "is not an array"))), ); + "is not an array")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TessLevelInnerNotFloatArray, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("TessLevelInner"), Values("TessellationEvaluation"), Values("Input"), Values("%u32arr2"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 2-component 32-bit float array", - "components are not float scalar"))), ); + "components are not float scalar")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TessLevelInnerNotFloatArr2, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("TessLevelInner"), Values("TessellationEvaluation"), Values("Input"), Values("%f32arr3"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 2-component 32-bit float array", - "has 3 components"))), ); + "has 3 components")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TessLevelInnerNotF32Arr2, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("TessLevelInner"), Values("TessellationEvaluation"), Values("Input"), Values("%f64arr2"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 2-component 32-bit float array", - "has components with bit width 64"))), ); + "has components with bit width 64")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( VertexIndexSuccess, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("VertexIndex"), Values("Vertex"), Values("Input"), - Values("%u32"), Values(TestResult())), ); + Values("%u32"), Values(TestResult()))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( + VertexIndexSuccess, + ValidateWebGPUCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("VertexIndex"), Values("Vertex"), Values("Input"), + Values("%u32"), Values(TestResult()))); + +INSTANTIATE_TEST_SUITE_P( VertexIndexInvalidExecutionModel, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, - Combine( - Values("VertexIndex"), - Values("Fragment", "GLCompute", "Geometry", "TessellationControl", - "TessellationEvaluation"), - Values("Input"), Values("%u32"), - Values(TestResult(SPV_ERROR_INVALID_DATA, - "to be used only with Vertex execution model"))), ); + Combine(Values("VertexIndex"), + Values("Fragment", "GLCompute", "Geometry", "TessellationControl", + "TessellationEvaluation"), + Values("Input"), Values("%u32"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "to be used only with Vertex execution model")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( + VertexIndexInvalidExecutionModel, + ValidateWebGPUCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("VertexIndex"), Values("Fragment", "GLCompute"), + Values("Input"), Values("%u32"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "to be used only with Vertex execution model")))); + +INSTANTIATE_TEST_SUITE_P( VertexIndexNotInput, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine( @@ -1780,34 +1762,97 @@ INSTANTIATE_TEST_CASE_P( Values("%u32"), Values(TestResult(SPV_ERROR_INVALID_DATA, "Vulkan spec allows BuiltIn VertexIndex to be only " - "used for variables with Input storage class"))), ); + "used for variables with Input storage class")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( + VertexIndexNotInput, + ValidateWebGPUCombineBuiltInExecutionModelDataTypeResult, + Combine( + Values("VertexIndex"), Values("Vertex"), Values("Output"), + Values("%u32"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "WebGPU spec allows BuiltIn VertexIndex to be only " + "used for variables with Input storage class")))); + +INSTANTIATE_TEST_SUITE_P( VertexIndexNotIntScalar, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("VertexIndex"), Values("Vertex"), Values("Input"), Values("%f32", "%u32vec3"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 32-bit int scalar", - "is not an int scalar"))), ); + "is not an int scalar")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( + VertexIndexNotIntScalar, + ValidateWebGPUCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("VertexIndex"), Values("Vertex"), Values("Input"), + Values("%f32", "%u32vec3"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 32-bit int scalar", + "is not an int scalar")))); + +INSTANTIATE_TEST_SUITE_P( VertexIndexNotInt32, ValidateVulkanCombineBuiltInExecutionModelDataTypeResult, Combine(Values("VertexIndex"), Values("Vertex"), Values("Input"), Values("%u64"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 32-bit int scalar", - "has bit width 64"))), ); + "has bit width 64")))); + +INSTANTIATE_TEST_SUITE_P( + LocalInvocationIndexSuccess, + ValidateWebGPUCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("LocalInvocationIndex"), Values("GLCompute"), + Values("Input"), Values("%u32"), Values(TestResult()))); + +INSTANTIATE_TEST_SUITE_P( + LocalInvocationIndexInvalidExecutionModel, + ValidateWebGPUCombineBuiltInExecutionModelDataTypeResult, + Combine( + Values("LocalInvocationIndex"), Values("Fragment", "Vertex"), + Values("Input"), Values("%u32"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "to be used only with GLCompute execution model")))); + +INSTANTIATE_TEST_SUITE_P( + LocalInvocationIndexNotInput, + ValidateWebGPUCombineBuiltInExecutionModelDataTypeResult, + Combine( + Values("LocalInvocationIndex"), Values("GLCompute"), Values("Output"), + Values("%u32"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "WebGPU spec allows BuiltIn LocalInvocationIndex to " + "be only used for variables with Input storage " + "class")))); + +INSTANTIATE_TEST_SUITE_P( + LocalInvocationIndexNotIntScalar, + ValidateWebGPUCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("LocalInvocationIndex"), Values("GLCompute"), + Values("Input"), Values("%f32", "%u32vec3"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "needs to be a 32-bit int", "is not an int")))); + +INSTANTIATE_TEST_SUITE_P( + WhitelistRejection, + ValidateWebGPUCombineBuiltInExecutionModelDataTypeResult, + Combine(Values("PointSize", "ClipDistance", "CullDistance", "VertexId", + "InstanceId", "PointCoord", "SampleMask", "HelperInvocation", + "WorkgroupId"), + Values("Vertex"), Values("Input"), Values("%u32"), + Values(TestResult(SPV_ERROR_INVALID_DATA, + "WebGPU does not allow BuiltIn")))); CodeGenerator GetArrayedVariableCodeGenerator(spv_target_env env, const char* const built_in, const char* const execution_model, const char* const storage_class, const char* const data_type) { - CodeGenerator generator = spvIsWebGPUEnv(env) - ? GetWebGPUShaderCodeGenerator() - : GetDefaultShaderCodeGenerator(); + CodeGenerator generator = + spvIsWebGPUEnv(env) ? CodeGenerator::GetWebGPUShaderCodeGenerator() + : CodeGenerator::GetDefaultShaderCodeGenerator(); generator.before_types_ = "OpDecorate %built_in_var BuiltIn "; generator.before_types_ += built_in; @@ -1905,50 +1950,50 @@ TEST_P(ValidateWebGPUCombineBuiltInArrayedVariable, Variable) { } } -INSTANTIATE_TEST_CASE_P(PointSizeArrayedF32TessControl, - ValidateVulkanCombineBuiltInArrayedVariable, - Combine(Values("PointSize"), - Values("TessellationControl"), Values("Input"), - Values("%f32"), Values(TestResult())), ); +INSTANTIATE_TEST_SUITE_P(PointSizeArrayedF32TessControl, + ValidateVulkanCombineBuiltInArrayedVariable, + Combine(Values("PointSize"), + Values("TessellationControl"), Values("Input"), + Values("%f32"), Values(TestResult()))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PointSizeArrayedF64TessControl, ValidateVulkanCombineBuiltInArrayedVariable, Combine(Values("PointSize"), Values("TessellationControl"), Values("Input"), Values("%f64"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 32-bit float scalar", - "has bit width 64"))), ); + "has bit width 64")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PointSizeArrayedF32Vertex, ValidateVulkanCombineBuiltInArrayedVariable, Combine(Values("PointSize"), Values("Vertex"), Values("Output"), Values("%f32"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 32-bit float scalar", - "is not a float scalar"))), ); + "is not a float scalar")))); -INSTANTIATE_TEST_CASE_P(PositionArrayedF32Vec4TessControl, - ValidateVulkanCombineBuiltInArrayedVariable, - Combine(Values("Position"), - Values("TessellationControl"), Values("Input"), - Values("%f32vec4"), Values(TestResult())), ); +INSTANTIATE_TEST_SUITE_P(PositionArrayedF32Vec4TessControl, + ValidateVulkanCombineBuiltInArrayedVariable, + Combine(Values("Position"), + Values("TessellationControl"), Values("Input"), + Values("%f32vec4"), Values(TestResult()))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PositionArrayedF32Vec3TessControl, ValidateVulkanCombineBuiltInArrayedVariable, Combine(Values("Position"), Values("TessellationControl"), Values("Input"), Values("%f32vec3"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 4-component 32-bit float vector", - "has 3 components"))), ); + "has 3 components")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( PositionArrayedF32Vec4Vertex, ValidateVulkanCombineBuiltInArrayedVariable, Combine(Values("Position"), Values("Vertex"), Values("Output"), Values("%f32vec4"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 4-component 32-bit float vector", - "is not a float vector"))), ); + "is not a float vector")))); INSTANTIATE_TEST_CASE_P( PositionArrayedF32Vec4Vertex, ValidateWebGPUCombineBuiltInArrayedVariable, @@ -1956,35 +2001,38 @@ INSTANTIATE_TEST_CASE_P( Values("%f32vec4"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 4-component 32-bit float vector", - "is not a float vector"))), ); + "is not a float vector")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ClipAndCullDistanceOutputSuccess, ValidateVulkanCombineBuiltInArrayedVariable, Combine(Values("ClipDistance", "CullDistance"), Values("Geometry", "TessellationControl", "TessellationEvaluation"), Values("Output"), Values("%f32arr2", "%f32arr4"), - Values(TestResult())), ); + Values(TestResult()))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ClipAndCullDistanceVertexInput, ValidateVulkanCombineBuiltInArrayedVariable, Combine(Values("ClipDistance", "CullDistance"), Values("Fragment"), Values("Input"), Values("%f32arr4"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 32-bit float array", - "components are not float scalar"))), ); + "components are not float scalar")))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ClipAndCullDistanceNotArray, ValidateVulkanCombineBuiltInArrayedVariable, Combine(Values("ClipDistance", "CullDistance"), Values("Geometry", "TessellationControl", "TessellationEvaluation"), Values("Input"), Values("%f32vec2", "%f32vec4"), Values(TestResult(SPV_ERROR_INVALID_DATA, "needs to be a 32-bit float array", - "components are not float scalar"))), ); + "components are not float scalar")))); + +CodeGenerator GetWorkgroupSizeSuccessGenerator(spv_target_env env) { + CodeGenerator generator = + env == SPV_ENV_WEBGPU_0 ? CodeGenerator::GetWebGPUShaderCodeGenerator() + : CodeGenerator::GetDefaultShaderCodeGenerator(); -TEST_F(ValidateBuiltIns, WorkgroupSizeSuccess) { - CodeGenerator generator = GetDefaultShaderCodeGenerator(); generator.before_types_ = R"( OpDecorate %workgroup_size BuiltIn WorkgroupSize )"; @@ -2001,12 +2049,27 @@ OpDecorate %workgroup_size BuiltIn WorkgroupSize )"; generator.entry_points_.push_back(std::move(entry_point)); + return generator; +} + +TEST_F(ValidateBuiltIns, VulkanWorkgroupSizeSuccess) { + CodeGenerator generator = + GetWorkgroupSizeSuccessGenerator(SPV_ENV_VULKAN_1_0); CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0); ASSERT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_VULKAN_1_0)); } -TEST_F(ValidateBuiltIns, WorkgroupSizeFragment) { - CodeGenerator generator = GetDefaultShaderCodeGenerator(); +TEST_F(ValidateBuiltIns, WebGPUWorkgroupSizeSuccess) { + CodeGenerator generator = GetWorkgroupSizeSuccessGenerator(SPV_ENV_WEBGPU_0); + CompileSuccessfully(generator.Build(), SPV_ENV_WEBGPU_0); + ASSERT_EQ(SPV_SUCCESS, ValidateInstructions(SPV_ENV_WEBGPU_0)); +} + +CodeGenerator GetWorkgroupSizeFragmentGenerator(spv_target_env env) { + CodeGenerator generator = + env == SPV_ENV_WEBGPU_0 ? CodeGenerator::GetWebGPUShaderCodeGenerator() + : CodeGenerator::GetDefaultShaderCodeGenerator(); + generator.before_types_ = R"( OpDecorate %workgroup_size BuiltIn WorkgroupSize )"; @@ -2024,6 +2087,13 @@ OpDecorate %workgroup_size BuiltIn WorkgroupSize )"; generator.entry_points_.push_back(std::move(entry_point)); + return generator; +} + +TEST_F(ValidateBuiltIns, VulkanWorkgroupSizeFragment) { + CodeGenerator generator = + GetWorkgroupSizeFragmentGenerator(SPV_ENV_VULKAN_1_0); + CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); EXPECT_THAT(getDiagnosticString(), @@ -2035,8 +2105,22 @@ OpDecorate %workgroup_size BuiltIn WorkgroupSize "called with execution model Fragment")); } +TEST_F(ValidateBuiltIns, WebGPUWorkgroupSizeFragment) { + CodeGenerator generator = GetWorkgroupSizeFragmentGenerator(SPV_ENV_WEBGPU_0); + + CompileSuccessfully(generator.Build(), SPV_ENV_WEBGPU_0); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_WEBGPU_0)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("WebGPU spec allows BuiltIn WorkgroupSize to be used " + "only with GLCompute execution model")); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("is referencing ID <2> (OpConstantComposite) which is " + "decorated with BuiltIn WorkgroupSize in function <1> " + "called with execution model Fragment")); +} + TEST_F(ValidateBuiltIns, WorkgroupSizeNotConstant) { - CodeGenerator generator = GetDefaultShaderCodeGenerator(); + CodeGenerator generator = CodeGenerator::GetDefaultShaderCodeGenerator(); generator.before_types_ = R"( OpDecorate %copy BuiltIn WorkgroupSize )"; @@ -2060,8 +2144,11 @@ OpDecorate %copy BuiltIn WorkgroupSize "constant. ID <2> (OpCopyObject) is not a constant")); } -TEST_F(ValidateBuiltIns, WorkgroupSizeNotVector) { - CodeGenerator generator = GetDefaultShaderCodeGenerator(); +CodeGenerator GetWorkgroupSizeNotVectorGenerator(spv_target_env env) { + CodeGenerator generator = + env == SPV_ENV_WEBGPU_0 ? CodeGenerator::GetWebGPUShaderCodeGenerator() + : CodeGenerator::GetDefaultShaderCodeGenerator(); + generator.before_types_ = R"( OpDecorate %workgroup_size BuiltIn WorkgroupSize )"; @@ -2078,6 +2165,13 @@ OpDecorate %workgroup_size BuiltIn WorkgroupSize )"; generator.entry_points_.push_back(std::move(entry_point)); + return generator; +} + +TEST_F(ValidateBuiltIns, VulkanWorkgroupSizeNotVector) { + CodeGenerator generator = + GetWorkgroupSizeNotVectorGenerator(SPV_ENV_VULKAN_1_0); + CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); EXPECT_THAT(getDiagnosticString(), @@ -2086,8 +2180,23 @@ OpDecorate %workgroup_size BuiltIn WorkgroupSize "ID <2> (OpConstant) is not an int vector.")); } -TEST_F(ValidateBuiltIns, WorkgroupSizeNotIntVector) { - CodeGenerator generator = GetDefaultShaderCodeGenerator(); +TEST_F(ValidateBuiltIns, WebGPUWorkgroupSizeNotVector) { + CodeGenerator generator = + GetWorkgroupSizeNotVectorGenerator(SPV_ENV_WEBGPU_0); + + CompileSuccessfully(generator.Build(), SPV_ENV_WEBGPU_0); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_WEBGPU_0)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("According to the WebGPU spec BuiltIn WorkgroupSize " + "variable needs to be a 3-component 32-bit int vector. " + "ID <2> (OpConstant) is not an int vector.")); +} + +CodeGenerator GetWorkgroupSizeNotIntVectorGenerator(spv_target_env env) { + CodeGenerator generator = + env == SPV_ENV_WEBGPU_0 ? CodeGenerator::GetWebGPUShaderCodeGenerator() + : CodeGenerator::GetDefaultShaderCodeGenerator(); + generator.before_types_ = R"( OpDecorate %workgroup_size BuiltIn WorkgroupSize )"; @@ -2104,6 +2213,13 @@ OpDecorate %workgroup_size BuiltIn WorkgroupSize )"; generator.entry_points_.push_back(std::move(entry_point)); + return generator; +} + +TEST_F(ValidateBuiltIns, VulkanWorkgroupSizeNotIntVector) { + CodeGenerator generator = + GetWorkgroupSizeNotIntVectorGenerator(SPV_ENV_VULKAN_1_0); + CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); EXPECT_THAT(getDiagnosticString(), @@ -2112,8 +2228,23 @@ OpDecorate %workgroup_size BuiltIn WorkgroupSize "ID <2> (OpConstantComposite) is not an int vector.")); } -TEST_F(ValidateBuiltIns, WorkgroupSizeNotVec3) { - CodeGenerator generator = GetDefaultShaderCodeGenerator(); +TEST_F(ValidateBuiltIns, WebGPUWorkgroupSizeNotIntVector) { + CodeGenerator generator = + GetWorkgroupSizeNotIntVectorGenerator(SPV_ENV_WEBGPU_0); + + CompileSuccessfully(generator.Build(), SPV_ENV_WEBGPU_0); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_WEBGPU_0)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("According to the WebGPU spec BuiltIn WorkgroupSize " + "variable needs to be a 3-component 32-bit int vector. " + "ID <2> (OpConstantComposite) is not an int vector.")); +} + +CodeGenerator GetWorkgroupSizeNotVec3Generator(spv_target_env env) { + CodeGenerator generator = + env == SPV_ENV_WEBGPU_0 ? CodeGenerator::GetWebGPUShaderCodeGenerator() + : CodeGenerator::GetDefaultShaderCodeGenerator(); + generator.before_types_ = R"( OpDecorate %workgroup_size BuiltIn WorkgroupSize )"; @@ -2130,6 +2261,13 @@ OpDecorate %workgroup_size BuiltIn WorkgroupSize )"; generator.entry_points_.push_back(std::move(entry_point)); + return generator; +} + +TEST_F(ValidateBuiltIns, VulkanWorkgroupSizeNotVec3) { + CodeGenerator generator = + GetWorkgroupSizeNotVec3Generator(SPV_ENV_VULKAN_1_0); + CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); EXPECT_THAT(getDiagnosticString(), @@ -2138,8 +2276,19 @@ OpDecorate %workgroup_size BuiltIn WorkgroupSize "ID <2> (OpConstantComposite) has 2 components.")); } +TEST_F(ValidateBuiltIns, WebGPUWorkgroupSizeNotVec3) { + CodeGenerator generator = GetWorkgroupSizeNotVec3Generator(SPV_ENV_WEBGPU_0); + + CompileSuccessfully(generator.Build(), SPV_ENV_WEBGPU_0); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_WEBGPU_0)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("According to the WebGPU spec BuiltIn WorkgroupSize " + "variable needs to be a 3-component 32-bit int vector. " + "ID <2> (OpConstantComposite) has 2 components.")); +} + TEST_F(ValidateBuiltIns, WorkgroupSizeNotInt32Vec) { - CodeGenerator generator = GetDefaultShaderCodeGenerator(); + CodeGenerator generator = CodeGenerator::GetDefaultShaderCodeGenerator(); generator.before_types_ = R"( OpDecorate %workgroup_size BuiltIn WorkgroupSize )"; @@ -2166,7 +2315,7 @@ OpDecorate %workgroup_size BuiltIn WorkgroupSize } TEST_F(ValidateBuiltIns, WorkgroupSizePrivateVar) { - CodeGenerator generator = GetDefaultShaderCodeGenerator(); + CodeGenerator generator = CodeGenerator::GetDefaultShaderCodeGenerator(); generator.before_types_ = R"( OpDecorate %workgroup_size BuiltIn WorkgroupSize )"; @@ -2189,7 +2338,7 @@ OpDecorate %workgroup_size BuiltIn WorkgroupSize } TEST_F(ValidateBuiltIns, GeometryPositionInOutSuccess) { - CodeGenerator generator = GetDefaultShaderCodeGenerator(); + CodeGenerator generator = CodeGenerator::GetDefaultShaderCodeGenerator(); generator.before_types_ = R"( OpMemberDecorate %input_type 0 BuiltIn Position @@ -2228,7 +2377,7 @@ OpStore %output_pos %pos } TEST_F(ValidateBuiltIns, WorkgroupIdNotVec3) { - CodeGenerator generator = GetDefaultShaderCodeGenerator(); + CodeGenerator generator = CodeGenerator::GetDefaultShaderCodeGenerator(); generator.before_types_ = R"( OpDecorate %workgroup_size BuiltIn WorkgroupSize OpDecorate %workgroup_id BuiltIn WorkgroupId @@ -2259,7 +2408,7 @@ OpDecorate %workgroup_id BuiltIn WorkgroupId } TEST_F(ValidateBuiltIns, TwoBuiltInsFirstFails) { - CodeGenerator generator = GetDefaultShaderCodeGenerator(); + CodeGenerator generator = CodeGenerator::GetDefaultShaderCodeGenerator(); generator.before_types_ = R"( OpMemberDecorate %input_type 0 BuiltIn FragCoord @@ -2299,7 +2448,7 @@ OpStore %output_pos %pos } TEST_F(ValidateBuiltIns, TwoBuiltInsSecondFails) { - CodeGenerator generator = GetDefaultShaderCodeGenerator(); + CodeGenerator generator = CodeGenerator::GetDefaultShaderCodeGenerator(); generator.before_types_ = R"( OpMemberDecorate %input_type 0 BuiltIn Position @@ -2339,7 +2488,7 @@ OpStore %output_pos %pos } TEST_F(ValidateBuiltIns, VertexPositionVariableSuccess) { - CodeGenerator generator = GetDefaultShaderCodeGenerator(); + CodeGenerator generator = CodeGenerator::GetDefaultShaderCodeGenerator(); generator.before_types_ = R"( OpDecorate %position BuiltIn Position )"; @@ -2363,7 +2512,7 @@ OpStore %position %f32vec4_0123 } TEST_F(ValidateBuiltIns, FragmentPositionTwoEntryPoints) { - CodeGenerator generator = GetDefaultShaderCodeGenerator(); + CodeGenerator generator = CodeGenerator::GetDefaultShaderCodeGenerator(); generator.before_types_ = R"( OpMemberDecorate %output_type 0 BuiltIn Position )"; @@ -2412,16 +2561,20 @@ OpFunctionEnd HasSubstr("called with execution model Fragment")); } -TEST_F(ValidateBuiltIns, FragmentFragDepthNoDepthReplacing) { - CodeGenerator generator = GetDefaultShaderCodeGenerator(); +CodeGenerator GetNoDepthReplacingGenerator(spv_target_env env) { + CodeGenerator generator = + spvIsWebGPUEnv(env) ? CodeGenerator::GetWebGPUShaderCodeGenerator() + : CodeGenerator::GetDefaultShaderCodeGenerator(); + generator.before_types_ = R"( OpMemberDecorate %output_type 0 BuiltIn FragDepth )"; generator.after_types_ = R"( %output_type = OpTypeStruct %f32 +%output_null = OpConstantNull %output_type %output_ptr = OpTypePointer Output %output_type -%output = OpVariable %output_ptr Output +%output = OpVariable %output_ptr Output %output_null %output_f32_ptr = OpTypePointer Output %f32 )"; @@ -2435,7 +2588,7 @@ OpMemberDecorate %output_type 0 BuiltIn FragDepth )"; generator.entry_points_.push_back(std::move(entry_point)); - generator.add_at_the_end_ = R"( + const std::string function_body = R"( %foo = OpFunction %void None %func %foo_entry = OpLabel %frag_depth = OpAccessChain %output_f32_ptr %output %u32_0 @@ -2444,6 +2597,18 @@ OpReturn OpFunctionEnd )"; + if (spvIsWebGPUEnv(env)) { + generator.after_types_ += function_body; + } else { + generator.add_at_the_end_ = function_body; + } + + return generator; +} + +TEST_F(ValidateBuiltIns, VulkanFragmentFragDepthNoDepthReplacing) { + CodeGenerator generator = GetNoDepthReplacingGenerator(SPV_ENV_VULKAN_1_0); + CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); EXPECT_THAT(getDiagnosticString(), @@ -2451,16 +2616,31 @@ OpFunctionEnd "be declared when using BuiltIn FragDepth")); } -TEST_F(ValidateBuiltIns, FragmentFragDepthOneMainHasDepthReplacingOtherHasnt) { - CodeGenerator generator = GetDefaultShaderCodeGenerator(); +TEST_F(ValidateBuiltIns, WebGPUFragmentFragDepthNoDepthReplacing) { + CodeGenerator generator = GetNoDepthReplacingGenerator(SPV_ENV_WEBGPU_0); + + CompileSuccessfully(generator.Build(), SPV_ENV_WEBGPU_0); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_WEBGPU_0)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("WebGPU spec requires DepthReplacing execution mode to " + "be declared when using BuiltIn FragDepth")); +} + +CodeGenerator GetOneMainHasDepthReplacingOtherHasntGenerator( + spv_target_env env) { + CodeGenerator generator = + spvIsWebGPUEnv(env) ? CodeGenerator::GetWebGPUShaderCodeGenerator() + : CodeGenerator::GetDefaultShaderCodeGenerator(); + generator.before_types_ = R"( OpMemberDecorate %output_type 0 BuiltIn FragDepth )"; generator.after_types_ = R"( %output_type = OpTypeStruct %f32 +%output_null = OpConstantNull %output_type %output_ptr = OpTypePointer Output %output_type -%output = OpVariable %output_ptr Output +%output = OpVariable %output_ptr Output %output_null %output_f32_ptr = OpTypePointer Output %f32 )"; @@ -2485,7 +2665,7 @@ OpMemberDecorate %output_type 0 BuiltIn FragDepth )"; generator.entry_points_.push_back(std::move(entry_point)); - generator.add_at_the_end_ = R"( + const std::string function_body = R"( %foo = OpFunction %void None %func %foo_entry = OpLabel %frag_depth = OpAccessChain %output_f32_ptr %output %u32_0 @@ -2494,6 +2674,20 @@ OpReturn OpFunctionEnd )"; + if (spvIsWebGPUEnv(env)) { + generator.after_types_ += function_body; + } else { + generator.add_at_the_end_ = function_body; + } + + return generator; +} + +TEST_F(ValidateBuiltIns, + VulkanFragmentFragDepthOneMainHasDepthReplacingOtherHasnt) { + CodeGenerator generator = + GetOneMainHasDepthReplacingOtherHasntGenerator(SPV_ENV_VULKAN_1_0); + CompileSuccessfully(generator.Build(), SPV_ENV_VULKAN_1_0); ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_VULKAN_1_0)); EXPECT_THAT(getDiagnosticString(), @@ -2501,8 +2695,20 @@ OpFunctionEnd "be declared when using BuiltIn FragDepth")); } +TEST_F(ValidateBuiltIns, + WebGPUFragmentFragDepthOneMainHasDepthReplacingOtherHasnt) { + CodeGenerator generator = + GetOneMainHasDepthReplacingOtherHasntGenerator(SPV_ENV_WEBGPU_0); + + CompileSuccessfully(generator.Build(), SPV_ENV_WEBGPU_0); + ASSERT_EQ(SPV_ERROR_INVALID_DATA, ValidateInstructions(SPV_ENV_WEBGPU_0)); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("WebGPU spec requires DepthReplacing execution mode to " + "be declared when using BuiltIn FragDepth")); +} + TEST_F(ValidateBuiltIns, AllowInstanceIdWithIntersectionShader) { - CodeGenerator generator = GetDefaultShaderCodeGenerator(); + CodeGenerator generator = CodeGenerator::GetDefaultShaderCodeGenerator(); generator.capabilities_ += R"( OpCapability RayTracingNV )"; @@ -2542,7 +2748,7 @@ OpFunctionEnd } TEST_F(ValidateBuiltIns, DisallowInstanceIdWithRayGenShader) { - CodeGenerator generator = GetDefaultShaderCodeGenerator(); + CodeGenerator generator = CodeGenerator::GetDefaultShaderCodeGenerator(); generator.capabilities_ += R"( OpCapability RayTracingNV )"; diff --git a/3rdparty/spirv-tools/test/val/val_capability_test.cpp b/3rdparty/spirv-tools/test/val/val_capability_test.cpp index 488e957ae..a1f1d3de0 100644 --- a/3rdparty/spirv-tools/test/val/val_capability_test.cpp +++ b/3rdparty/spirv-tools/test/val/val_capability_test.cpp @@ -611,7 +611,7 @@ const char kVoidFVoid2[] = \ " OpReturn" " OpFunctionEnd "; -INSTANTIATE_TEST_CASE_P(ExecutionModel, ValidateCapability, +INSTANTIATE_TEST_SUITE_P(ExecutionModel, ValidateCapability, Combine( ValuesIn(AllCapabilities()), Values( @@ -639,9 +639,9 @@ std::make_pair(std::string(kOpenCLMemoryModel) + std::make_pair(std::string(kGLSL450MemoryModel) + " OpEntryPoint Kernel %func \"shader\"" + std::string(kVoidFVoid), KernelDependencies()) -)),); +))); -INSTANTIATE_TEST_CASE_P(AddressingAndMemoryModel, ValidateCapability, +INSTANTIATE_TEST_SUITE_P(AddressingAndMemoryModel, ValidateCapability, Combine( ValuesIn(AllCapabilities()), Values( @@ -681,9 +681,9 @@ std::make_pair(" OpCapability Kernel" " OpMemoryModel Physical64 OpenCL" " OpEntryPoint Kernel %func \"compute\"" + std::string(kVoidFVoid), AddressesDependencies()) -)),); +))); -INSTANTIATE_TEST_CASE_P(ExecutionMode, ValidateCapability, +INSTANTIATE_TEST_SUITE_P(ExecutionMode, ValidateCapability, Combine( ValuesIn(AllCapabilities()), Values( @@ -836,11 +836,11 @@ std::make_pair(std::string(kGLSL450MemoryModel) + std::make_pair(std::string(kGLSL450MemoryModel) + "OpEntryPoint Kernel %func \"shader\" " "OpExecutionMode %func ContractionOff" + - std::string(kVoidFVoid), KernelDependencies()))),); + std::string(kVoidFVoid), KernelDependencies())))); // clang-format on -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ExecutionModeV11, ValidateCapabilityV11, Combine(ValuesIn(AllCapabilities()), Values(std::make_pair(std::string(kOpenCLMemoryModel) + @@ -853,10 +853,10 @@ INSTANTIATE_TEST_CASE_P( "OpEntryPoint Kernel %func \"shader\" " "OpExecutionMode %func SubgroupsPerWorkgroup 65535" + std::string(kVoidFVoid), - std::vector{"SubgroupDispatch"}))), ); + std::vector{"SubgroupDispatch"})))); // clang-format off -INSTANTIATE_TEST_CASE_P(StorageClass, ValidateCapability, +INSTANTIATE_TEST_SUITE_P(StorageClass, ValidateCapability, Combine( ValuesIn(AllCapabilities()), Values( @@ -920,9 +920,9 @@ std::make_pair(std::string(kGLSL450MemoryModel) + " %ptrt = OpTypePointer Image %intt\n" " %var = OpVariable %ptrt Image\n" + std::string(kVoidFVoid), AllCapabilities()) -)),); +))); -INSTANTIATE_TEST_CASE_P(Dim, ValidateCapability, +INSTANTIATE_TEST_SUITE_P(Dim, ValidateCapability, Combine( ValuesIn(AllCapabilities()), Values( @@ -968,11 +968,11 @@ std::make_pair(" OpCapability ImageBasic" + " %voidt = OpTypeVoid" " %imgt = OpTypeImage %voidt SubpassData 0 0 0 2 Unknown" + std::string(kVoidFVoid2), std::vector{"InputAttachment"}) -)),); +))); // NOTE: All Sampler Address Modes require kernel capabilities but the // OpConstantSampler requires LiteralSampler which depends on Kernel -INSTANTIATE_TEST_CASE_P(SamplerAddressingMode, ValidateCapability, +INSTANTIATE_TEST_SUITE_P(SamplerAddressingMode, ValidateCapability, Combine( ValuesIn(AllCapabilities()), Values( @@ -1006,7 +1006,7 @@ std::make_pair(std::string(kGLSL450MemoryModel) + " %sampler = OpConstantSampler %samplert RepeatMirrored 1 Nearest" + std::string(kVoidFVoid), std::vector{"LiteralSampler"}) -)),); +))); // TODO(umar): Sampler Filter Mode // TODO(umar): Image Format @@ -1019,7 +1019,7 @@ std::make_pair(std::string(kGLSL450MemoryModel) + // TODO(umar): Access Qualifier // TODO(umar): Function Parameter Attribute -INSTANTIATE_TEST_CASE_P(Decoration, ValidateCapability, +INSTANTIATE_TEST_SUITE_P(Decoration, ValidateCapability, Combine( ValuesIn(AllCapabilities()), Values( @@ -1129,9 +1129,14 @@ std::make_pair(std::string(kOpenCLMemoryModel) + "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), AllCapabilities()), std::make_pair(std::string(kOpenCLMemoryModel) + + // NonWritable must target something valid, such as a storage image. "OpEntryPoint Kernel %func \"compute\" \n" - "OpDecorate %intt NonWritable\n" - "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), + "OpDecorate %var NonWritable " + "%float = OpTypeFloat 32 " + "%imstor = OpTypeImage %float 2D 0 0 0 2 Unknown " + "%ptr = OpTypePointer UniformConstant %imstor " + "%var = OpVariable %ptr UniformConstant " + + std::string(kVoidFVoid), AllCapabilities()), std::make_pair(std::string(kOpenCLMemoryModel) + "OpEntryPoint Kernel %func \"compute\" \n" @@ -1226,10 +1231,10 @@ std::make_pair(std::string(kGLSL450MemoryModel) + "OpDecorate %intt Alignment 4\n" "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), KernelDependencies()) -)),); +))); // clang-format on -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( DecorationSpecId, ValidateCapability, Combine( ValuesIn(AllSpirV10Capabilities()), @@ -1239,9 +1244,9 @@ INSTANTIATE_TEST_CASE_P( "%intt = OpTypeInt 32 0\n" "%1 = OpSpecConstant %intt 0\n" + std::string(kVoidFVoid), - ShaderDependencies()))), ); + ShaderDependencies())))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( DecorationV11, ValidateCapabilityV11, Combine(ValuesIn(AllCapabilities()), Values(std::make_pair(std::string(kOpenCLMemoryModel) + @@ -1270,10 +1275,10 @@ INSTANTIATE_TEST_CASE_P( "%intt = OpTypeInt 32 0 " "%1 = OpSpecConstant %intt 0") + std::string(kVoidFVoid), - ShaderDependencies()))), ); + ShaderDependencies())))); // clang-format off -INSTANTIATE_TEST_CASE_P(BuiltIn, ValidateCapability, +INSTANTIATE_TEST_SUITE_P(BuiltIn, ValidateCapability, Combine( ValuesIn(AllCapabilities()), Values( @@ -1495,13 +1500,13 @@ std::make_pair(std::string(kOpenCLMemoryModel) + "OpDecorate %intt BuiltIn InstanceIndex\n" "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), ShaderDependencies()) -)),); +))); // Ensure that mere mention of PointSize, ClipDistance, or CullDistance as // BuiltIns does not trigger the requirement for the associated // capability. // See https://github.com/KhronosGroup/SPIRV-Tools/issues/365 -INSTANTIATE_TEST_CASE_P(BuiltIn, ValidateCapabilityVulkan10, +INSTANTIATE_TEST_SUITE_P(BuiltIn, ValidateCapabilityVulkan10, Combine( // All capabilities to try. ValuesIn(AllSpirV10Capabilities()), @@ -1532,9 +1537,9 @@ std::make_pair(std::string(kGLSL450MemoryModel) + "%f32arr4 = OpTypeArray %f32 %intt_4\n" "%block = OpTypeStruct %f32arr4\n" + std::string(kVoidFVoid), AllVulkan10Capabilities()) -)),); +))); -INSTANTIATE_TEST_CASE_P(BuiltIn, ValidateCapabilityOpenGL40, +INSTANTIATE_TEST_SUITE_P(BuiltIn, ValidateCapabilityOpenGL40, Combine( // OpenGL 4.0 is based on SPIR-V 1.0 ValuesIn(AllSpirV10Capabilities()), @@ -1554,9 +1559,9 @@ std::make_pair(std::string(kGLSL450MemoryModel) + "OpDecorate %intt BuiltIn CullDistance\n" "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), AllSpirV10Capabilities()) -)),); +))); -INSTANTIATE_TEST_CASE_P(Capabilities, ValidateCapabilityWebGPU, +INSTANTIATE_TEST_SUITE_P(Capabilities, ValidateCapabilityWebGPU, Combine( // All capabilities to try. ValuesIn(AllCapabilities()), @@ -1564,9 +1569,9 @@ INSTANTIATE_TEST_CASE_P(Capabilities, ValidateCapabilityWebGPU, std::make_pair(std::string(kVulkanMemoryModel) + "OpEntryPoint Vertex %func \"shader\" \n" + std::string(kVoidFVoid), AllWebGPUCapabilities()) -)),); +))); -INSTANTIATE_TEST_CASE_P(Capabilities, ValidateCapabilityVulkan11, +INSTANTIATE_TEST_SUITE_P(Capabilities, ValidateCapabilityVulkan11, Combine( // All capabilities to try. ValuesIn(AllCapabilities()), @@ -1581,7 +1586,7 @@ std::make_pair(std::string(kGLSL450MemoryModel) + "OpDecorate %intt BuiltIn CullDistance\n" "%intt = OpTypeInt 32 0\n" + std::string(kVoidFVoid), AllVulkan11Capabilities()) -)),); +))); // TODO(umar): Selection Control // TODO(umar): Loop Control @@ -1593,7 +1598,7 @@ std::make_pair(std::string(kGLSL450MemoryModel) + // TODO(umar): Kernel Enqueue Flags // TODO(umar): Kernel Profiling Flags -INSTANTIATE_TEST_CASE_P(MatrixOp, ValidateCapability, +INSTANTIATE_TEST_SUITE_P(MatrixOp, ValidateCapability, Combine( ValuesIn(AllCapabilities()), Values( @@ -1602,7 +1607,7 @@ std::make_pair(std::string(kOpenCLMemoryModel) + "%f32 = OpTypeFloat 32\n" "%vec3 = OpTypeVector %f32 3\n" "%mat33 = OpTypeMatrix %vec3 3\n" + std::string(kVoidFVoid), - MatrixDependencies()))),); + MatrixDependencies())))); // clang-format on #if 0 @@ -1643,7 +1648,7 @@ OpFunctionEnd return ss.str(); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( TwoImageOperandsMask, ValidateCapability, Combine( ValuesIn(AllCapabilities()), diff --git a/3rdparty/spirv-tools/test/val/val_cfg_test.cpp b/3rdparty/spirv-tools/test/val/val_cfg_test.cpp index fae570278..3c0b5b5eb 100644 --- a/3rdparty/spirv-tools/test/val/val_cfg_test.cpp +++ b/3rdparty/spirv-tools/test/val/val_cfg_test.cpp @@ -171,9 +171,9 @@ const char* types_consts() { return types; } -INSTANTIATE_TEST_CASE_P(StructuredControlFlow, ValidateCFG, - ::testing::Values(SpvCapabilityShader, - SpvCapabilityKernel)); +INSTANTIATE_TEST_SUITE_P(StructuredControlFlow, ValidateCFG, + ::testing::Values(SpvCapabilityShader, + SpvCapabilityKernel)); TEST_P(ValidateCFG, LoopReachableFromEntryButNeverLeadingToReturn) { // In this case, the loop is reachable from a node without a predecessor, diff --git a/3rdparty/spirv-tools/test/val/val_code_generator.cpp b/3rdparty/spirv-tools/test/val/val_code_generator.cpp new file mode 100644 index 000000000..1c83517d9 --- /dev/null +++ b/3rdparty/spirv-tools/test/val/val_code_generator.cpp @@ -0,0 +1,222 @@ +// Copyright (c) 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. + +#include "test/val/val_code_generator.h" + +#include + +namespace spvtools { +namespace val { +namespace { + +std::string GetDefaultShaderCapabilities() { + return R"( +OpCapability Shader +OpCapability Geometry +OpCapability Tessellation +OpCapability Float64 +OpCapability Int64 +OpCapability MultiViewport +OpCapability SampleRateShading +)"; +} + +std::string GetWebGPUShaderCapabilities() { + return R"( +OpCapability Shader +OpCapability VulkanMemoryModelKHR +)"; +} + +std::string GetDefaultShaderTypes() { + return R"( +%void = OpTypeVoid +%func = OpTypeFunction %void +%bool = OpTypeBool +%f32 = OpTypeFloat 32 +%f64 = OpTypeFloat 64 +%u32 = OpTypeInt 32 0 +%u64 = OpTypeInt 64 0 +%f32vec2 = OpTypeVector %f32 2 +%f32vec3 = OpTypeVector %f32 3 +%f32vec4 = OpTypeVector %f32 4 +%f64vec2 = OpTypeVector %f64 2 +%f64vec3 = OpTypeVector %f64 3 +%f64vec4 = OpTypeVector %f64 4 +%u32vec2 = OpTypeVector %u32 2 +%u32vec3 = OpTypeVector %u32 3 +%u64vec3 = OpTypeVector %u64 3 +%u32vec4 = OpTypeVector %u32 4 +%u64vec2 = OpTypeVector %u64 2 + +%f32_0 = OpConstant %f32 0 +%f32_1 = OpConstant %f32 1 +%f32_2 = OpConstant %f32 2 +%f32_3 = OpConstant %f32 3 +%f32_4 = OpConstant %f32 4 +%f32_h = OpConstant %f32 0.5 +%f32vec2_01 = OpConstantComposite %f32vec2 %f32_0 %f32_1 +%f32vec2_12 = OpConstantComposite %f32vec2 %f32_1 %f32_2 +%f32vec3_012 = OpConstantComposite %f32vec3 %f32_0 %f32_1 %f32_2 +%f32vec3_123 = OpConstantComposite %f32vec3 %f32_1 %f32_2 %f32_3 +%f32vec4_0123 = OpConstantComposite %f32vec4 %f32_0 %f32_1 %f32_2 %f32_3 +%f32vec4_1234 = OpConstantComposite %f32vec4 %f32_1 %f32_2 %f32_3 %f32_4 + +%f64_0 = OpConstant %f64 0 +%f64_1 = OpConstant %f64 1 +%f64_2 = OpConstant %f64 2 +%f64_3 = OpConstant %f64 3 +%f64vec2_01 = OpConstantComposite %f64vec2 %f64_0 %f64_1 +%f64vec3_012 = OpConstantComposite %f64vec3 %f64_0 %f64_1 %f64_2 +%f64vec4_0123 = OpConstantComposite %f64vec4 %f64_0 %f64_1 %f64_2 %f64_3 + +%u32_0 = OpConstant %u32 0 +%u32_1 = OpConstant %u32 1 +%u32_2 = OpConstant %u32 2 +%u32_3 = OpConstant %u32 3 +%u32_4 = OpConstant %u32 4 + +%u64_0 = OpConstant %u64 0 +%u64_1 = OpConstant %u64 1 +%u64_2 = OpConstant %u64 2 +%u64_3 = OpConstant %u64 3 + +%u32vec2_01 = OpConstantComposite %u32vec2 %u32_0 %u32_1 +%u32vec2_12 = OpConstantComposite %u32vec2 %u32_1 %u32_2 +%u32vec4_0123 = OpConstantComposite %u32vec4 %u32_0 %u32_1 %u32_2 %u32_3 +%u64vec2_01 = OpConstantComposite %u64vec2 %u64_0 %u64_1 + +%u32arr2 = OpTypeArray %u32 %u32_2 +%u32arr3 = OpTypeArray %u32 %u32_3 +%u32arr4 = OpTypeArray %u32 %u32_4 +%u64arr2 = OpTypeArray %u64 %u32_2 +%u64arr3 = OpTypeArray %u64 %u32_3 +%u64arr4 = OpTypeArray %u64 %u32_4 +%f32arr2 = OpTypeArray %f32 %u32_2 +%f32arr3 = OpTypeArray %f32 %u32_3 +%f32arr4 = OpTypeArray %f32 %u32_4 +%f64arr2 = OpTypeArray %f64 %u32_2 +%f64arr3 = OpTypeArray %f64 %u32_3 +%f64arr4 = OpTypeArray %f64 %u32_4 + +%f32vec3arr3 = OpTypeArray %f32vec3 %u32_3 +%f32vec4arr3 = OpTypeArray %f32vec4 %u32_3 +%f64vec4arr3 = OpTypeArray %f64vec4 %u32_3 +)"; +} + +std::string GetWebGPUShaderTypes() { + return R"( +%void = OpTypeVoid +%func = OpTypeFunction %void +%bool = OpTypeBool +%f32 = OpTypeFloat 32 +%u32 = OpTypeInt 32 0 +%f32vec2 = OpTypeVector %f32 2 +%f32vec3 = OpTypeVector %f32 3 +%f32vec4 = OpTypeVector %f32 4 +%u32vec2 = OpTypeVector %u32 2 +%u32vec3 = OpTypeVector %u32 3 +%u32vec4 = OpTypeVector %u32 4 + +%f32_0 = OpConstant %f32 0 +%f32_1 = OpConstant %f32 1 +%f32_2 = OpConstant %f32 2 +%f32_3 = OpConstant %f32 3 +%f32_4 = OpConstant %f32 4 +%f32_h = OpConstant %f32 0.5 +%f32vec2_01 = OpConstantComposite %f32vec2 %f32_0 %f32_1 +%f32vec2_12 = OpConstantComposite %f32vec2 %f32_1 %f32_2 +%f32vec3_012 = OpConstantComposite %f32vec3 %f32_0 %f32_1 %f32_2 +%f32vec3_123 = OpConstantComposite %f32vec3 %f32_1 %f32_2 %f32_3 +%f32vec4_0123 = OpConstantComposite %f32vec4 %f32_0 %f32_1 %f32_2 %f32_3 +%f32vec4_1234 = OpConstantComposite %f32vec4 %f32_1 %f32_2 %f32_3 %f32_4 + +%u32_0 = OpConstant %u32 0 +%u32_1 = OpConstant %u32 1 +%u32_2 = OpConstant %u32 2 +%u32_3 = OpConstant %u32 3 +%u32_4 = OpConstant %u32 4 + +%u32vec2_01 = OpConstantComposite %u32vec2 %u32_0 %u32_1 +%u32vec2_12 = OpConstantComposite %u32vec2 %u32_1 %u32_2 +%u32vec4_0123 = OpConstantComposite %u32vec4 %u32_0 %u32_1 %u32_2 %u32_3 + +%u32arr2 = OpTypeArray %u32 %u32_2 +%u32arr3 = OpTypeArray %u32 %u32_3 +%u32arr4 = OpTypeArray %u32 %u32_4 +%f32arr2 = OpTypeArray %f32 %u32_2 +%f32arr3 = OpTypeArray %f32 %u32_3 +%f32arr4 = OpTypeArray %f32 %u32_4 + +%f32vec3arr3 = OpTypeArray %f32vec3 %u32_3 +%f32vec4arr3 = OpTypeArray %f32vec4 %u32_3 +)"; +} + +} // namespace + +CodeGenerator CodeGenerator::GetDefaultShaderCodeGenerator() { + CodeGenerator generator; + generator.capabilities_ = GetDefaultShaderCapabilities(); + generator.memory_model_ = "OpMemoryModel Logical GLSL450\n"; + generator.types_ = GetDefaultShaderTypes(); + return generator; +} + +CodeGenerator CodeGenerator::GetWebGPUShaderCodeGenerator() { + CodeGenerator generator; + generator.capabilities_ = GetWebGPUShaderCapabilities(); + generator.memory_model_ = "OpMemoryModel Logical VulkanKHR\n"; + generator.extensions_ = "OpExtension \"SPV_KHR_vulkan_memory_model\"\n"; + generator.types_ = GetWebGPUShaderTypes(); + return generator; +} + +std::string CodeGenerator::Build() const { + std::ostringstream ss; + + ss << capabilities_; + ss << extensions_; + ss << memory_model_; + + for (const EntryPoint& entry_point : entry_points_) { + ss << "OpEntryPoint " << entry_point.execution_model << " %" + << entry_point.name << " \"" << entry_point.name << "\" " + << entry_point.interfaces << "\n"; + } + + for (const EntryPoint& entry_point : entry_points_) { + ss << entry_point.execution_modes << "\n"; + } + + ss << before_types_; + ss << types_; + ss << after_types_; + + for (const EntryPoint& entry_point : entry_points_) { + ss << "\n"; + ss << "%" << entry_point.name << " = OpFunction %void None %func\n"; + ss << "%" << entry_point.name << "_entry = OpLabel\n"; + ss << entry_point.body; + ss << "\nOpReturn\nOpFunctionEnd\n"; + } + + ss << add_at_the_end_; + + return ss.str(); +} + +} // namespace val +} // namespace spvtools diff --git a/3rdparty/spirv-tools/test/val/val_code_generator.h b/3rdparty/spirv-tools/test/val/val_code_generator.h new file mode 100644 index 000000000..e580ddff7 --- /dev/null +++ b/3rdparty/spirv-tools/test/val/val_code_generator.h @@ -0,0 +1,49 @@ +// Copyright (c) 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. + +// Utility class used to generate SPIR-V code strings for tests + +#include +#include + +namespace spvtools { +namespace val { + +struct EntryPoint { + std::string name; + std::string execution_model; + std::string execution_modes; + std::string body; + std::string interfaces; +}; + +class CodeGenerator { + public: + static CodeGenerator GetDefaultShaderCodeGenerator(); + static CodeGenerator GetWebGPUShaderCodeGenerator(); + + std::string Build() const; + + std::vector entry_points_; + std::string capabilities_; + std::string extensions_; + std::string memory_model_; + std::string before_types_; + std::string types_; + std::string after_types_; + std::string add_at_the_end_; +}; + +} // namespace val +} // namespace spvtools diff --git a/3rdparty/spirv-tools/test/val/val_constants_test.cpp b/3rdparty/spirv-tools/test/val/val_constants_test.cpp index 824d6fda5..4bced25cc 100644 --- a/3rdparty/spirv-tools/test/val/val_constants_test.cpp +++ b/3rdparty/spirv-tools/test/val/val_constants_test.cpp @@ -84,7 +84,7 @@ TEST_P(ValidateConstantOp, Samples) { { SPV_ENV_UNIVERSAL_1_0, kShaderPreamble kBasicTypes STR, true, "" } #define GOOD_KERNEL_10(STR) \ { SPV_ENV_UNIVERSAL_1_0, kKernelPreamble kBasicTypes STR, true, "" } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( UniversalInShader, ValidateConstantOp, ValuesIn(std::vector{ // TODO(dneto): Conversions must change width. @@ -141,7 +141,7 @@ INSTANTIATE_TEST_CASE_P( "%v = OpSpecConstantOp %bool SGreaterThanEqual %uint_0 %uint_0"), })); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( UniversalInKernel, ValidateConstantOp, ValuesIn(std::vector{ // TODO(dneto): Conversions must change width. @@ -198,7 +198,7 @@ INSTANTIATE_TEST_CASE_P( "%v = OpSpecConstantOp %bool SGreaterThanEqual %uint_0 %uint_0"), })); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( KernelInKernel, ValidateConstantOp, ValuesIn(std::vector{ // TODO(dneto): Conversions must change width. @@ -235,7 +235,7 @@ INSTANTIATE_TEST_CASE_P( "Specialization constant operation " NAME \ " requires Kernel capability" \ } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( KernelInShader, ValidateConstantOp, ValuesIn(std::vector{ // TODO(dneto): Conversions must change width. @@ -280,7 +280,7 @@ INSTANTIATE_TEST_CASE_P( "InBoundsPtrAccessChain"), })); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( UConvertInAMD_gpu_shader_int16, ValidateConstantOp, ValuesIn(std::vector{ // SPV_AMD_gpu_shader_int16 should enable UConvert for OpSpecConstantOp diff --git a/3rdparty/spirv-tools/test/val/val_decoration_test.cpp b/3rdparty/spirv-tools/test/val/val_decoration_test.cpp index 1506a29a6..c8dfc8d38 100644 --- a/3rdparty/spirv-tools/test/val/val_decoration_test.cpp +++ b/3rdparty/spirv-tools/test/val/val_decoration_test.cpp @@ -20,16 +20,29 @@ #include "gmock/gmock.h" #include "source/val/decoration.h" #include "test/unit_spirv.h" +#include "test/val/val_code_generator.h" #include "test/val/val_fixtures.h" namespace spvtools { namespace val { namespace { +using ::testing::Combine; using ::testing::Eq; using ::testing::HasSubstr; +using ::testing::Values; + +struct TestResult { + TestResult(spv_result_t in_validation_result = SPV_SUCCESS, + const std::string& in_error_str = "") + : validation_result(in_validation_result), error_str(in_error_str) {} + spv_result_t validation_result; + const std::string error_str; +}; using ValidateDecorations = spvtest::ValidateBase; +using ValidateWebGPUCombineDecorationResult = + spvtest::ValidateBase>; TEST_F(ValidateDecorations, ValidateOpDecorateRegistration) { std::string spirv = R"( @@ -115,7 +128,7 @@ TEST_F(ValidateDecorations, ValidateGroupDecorateRegistration) { OpCapability Linkage OpMemoryModel Logical GLSL450 OpDecorate %1 DescriptorSet 0 - OpDecorate %1 NonWritable + OpDecorate %1 RelaxedPrecision OpDecorate %1 Restrict %1 = OpDecorationGroup OpGroupDecorate %1 %2 %3 @@ -136,9 +149,10 @@ TEST_F(ValidateDecorations, ValidateGroupDecorateRegistration) { EXPECT_EQ(SPV_SUCCESS, ValidateAndRetrieveValidationState()); // Decoration group has 3 decorations. - auto expected_decorations = std::vector{ - Decoration(SpvDecorationDescriptorSet, {0}), - Decoration(SpvDecorationNonWritable), Decoration(SpvDecorationRestrict)}; + auto expected_decorations = + std::vector{Decoration(SpvDecorationDescriptorSet, {0}), + Decoration(SpvDecorationRelaxedPrecision), + Decoration(SpvDecorationRestrict)}; // Decoration group is applied to id 1, 2, 3, and 4. Note that id 1 (which is // the decoration group id) also has all the decorations. @@ -5491,6 +5505,316 @@ OpFunctionEnd "improperly straddling vector at offset 28")); } +// NonWritable + +// Returns a SPIR-V shader module with variables in various storage classes, +// parameterizable by which ID should be decorated as NonWritable. +std::string ShaderWithNonWritableTarget(const std::string& target, + bool member_decorate = false) { + const std::string decoration_inst = + std::string(member_decorate ? "OpMemberDecorate " : "OpDecorate ") + + target + (member_decorate ? " 0" : ""); + + return std::string(R"( + OpCapability Shader + OpExtension "SPV_KHR_storage_buffer_storage_class" + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %main "main" + OpName %label "label" + OpName %param_f "param_f" + OpName %param_p "param_p" + OpName %_ptr_imstor "_ptr_imstor" + OpName %_ptr_imsam "_ptr_imsam" + OpName %var_wg "var_wg" + OpName %var_imsam "var_imsam" + OpName %var_priv "var_priv" + OpName %var_func "var_func" + OpName %struct_bad "struct_bad" + + OpDecorate %struct_b Block + OpDecorate %struct_bb BufferBlock + OpDecorate %struct_b_rtarr Block + OpMemberDecorate %struct_b 0 Offset 0 + OpMemberDecorate %struct_bb 0 Offset 0 + OpMemberDecorate %struct_b_rtarr 0 Offset 0 + OpDecorate %rtarr ArrayStride 4 +)") + decoration_inst + + + R"( NonWritable + + %void = OpTypeVoid + %void_fn = OpTypeFunction %void + %float = OpTypeFloat 32 + %float_0 = OpConstant %float 0 + %struct_b = OpTypeStruct %float + %struct_bb = OpTypeStruct %float + %rtarr = OpTypeRuntimeArray %float +%struct_b_rtarr = OpTypeStruct %rtarr +%struct_bad = OpTypeStruct %float + ; storage image + %imstor = OpTypeImage %float 2D 0 0 0 2 R32f + ; sampled image + %imsam = OpTypeImage %float 2D 0 0 0 1 R32f + +%_ptr_Uniform_stb = OpTypePointer Uniform %struct_b +%_ptr_Uniform_stbb = OpTypePointer Uniform %struct_bb +%_ptr_StorageBuffer_stb = OpTypePointer StorageBuffer %struct_b +%_ptr_StorageBuffer_stb_rtarr = OpTypePointer StorageBuffer %struct_b_rtarr +%_ptr_Workgroup = OpTypePointer Workgroup %float +%_ptr_Private = OpTypePointer Private %float +%_ptr_Function = OpTypePointer Function %float +%_ptr_imstor = OpTypePointer UniformConstant %imstor +%_ptr_imsam = OpTypePointer UniformConstant %imsam + +%extra_fn = OpTypeFunction %void %float %_ptr_Private %_ptr_imstor + +%var_ubo = OpVariable %_ptr_Uniform_stb Uniform +%var_ssbo_u = OpVariable %_ptr_Uniform_stbb Uniform +%var_ssbo_sb = OpVariable %_ptr_StorageBuffer_stb StorageBuffer +%var_ssbo_sb_rtarr = OpVariable %_ptr_StorageBuffer_stb_rtarr StorageBuffer +%var_wg = OpVariable %_ptr_Workgroup Workgroup +%var_priv = OpVariable %_ptr_Private Private +%var_imstor = OpVariable %_ptr_imstor UniformConstant +%var_imsam = OpVariable %_ptr_imsam UniformConstant + + %helper = OpFunction %void None %extra_fn + %param_f = OpFunctionParameter %float + %param_p = OpFunctionParameter %_ptr_Private + %param_pimstor = OpFunctionParameter %_ptr_imstor +%helper_label = OpLabel +%helper_func_var = OpVariable %_ptr_Function Function + OpReturn + OpFunctionEnd + + %main = OpFunction %void None %void_fn + %label = OpLabel +%var_func = OpVariable %_ptr_Function Function + OpReturn + OpFunctionEnd +)"; +} + +TEST_F(ValidateDecorations, NonWritableLabelTargetBad) { + std::string spirv = ShaderWithNonWritableTarget("%label"); + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Target of NonWritable decoration must be a " + "memory object declaration (a variable or a function " + "parameter)\n %label = OpLabel")); +} + +TEST_F(ValidateDecorations, NonWritableTypeTargetBad) { + std::string spirv = ShaderWithNonWritableTarget("%void"); + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Target of NonWritable decoration must be a " + "memory object declaration (a variable or a function " + "parameter)\n %void = OpTypeVoid")); +} + +TEST_F(ValidateDecorations, NonWritableValueTargetBad) { + std::string spirv = ShaderWithNonWritableTarget("%float_0"); + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Target of NonWritable decoration must be a " + "memory object declaration (a variable or a function " + "parameter)\n %float_0 = OpConstant %float 0")); +} + +TEST_F(ValidateDecorations, NonWritableValueParamBad) { + std::string spirv = ShaderWithNonWritableTarget("%param_f"); + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Target of NonWritable decoration is invalid: must " + "point to a storage image, uniform block, or storage " + "buffer\n %param_f = OpFunctionParameter %float")); +} + +TEST_F(ValidateDecorations, NonWritablePointerParamButWrongTypeBad) { + std::string spirv = ShaderWithNonWritableTarget("%param_p"); + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr( + "Target of NonWritable decoration is invalid: must " + "point to a storage image, uniform block, or storage " + "buffer\n %param_p = OpFunctionParameter %_ptr_Private_float")); +} + +TEST_F(ValidateDecorations, NonWritablePointerParamStorageImageGood) { + std::string spirv = ShaderWithNonWritableTarget("%param_pimstor"); + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), Eq("")); +} + +TEST_F(ValidateDecorations, NonWritableVarStorageImageGood) { + std::string spirv = ShaderWithNonWritableTarget("%var_imstor"); + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), Eq("")); +} + +TEST_F(ValidateDecorations, NonWritableVarSampledImageBad) { + std::string spirv = ShaderWithNonWritableTarget("%var_imsam"); + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Target of NonWritable decoration is invalid: must " + "point to a storage image, uniform block, or storage " + "buffer\n %var_imsam")); +} + +TEST_F(ValidateDecorations, NonWritableVarUboGood) { + std::string spirv = ShaderWithNonWritableTarget("%var_ubo"); + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), Eq("")); +} + +TEST_F(ValidateDecorations, NonWritableVarSsboInUniformGood) { + std::string spirv = ShaderWithNonWritableTarget("%var_ssbo_u"); + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), Eq("")); +} + +TEST_F(ValidateDecorations, NonWritableVarSsboInStorageBufferGood) { + std::string spirv = ShaderWithNonWritableTarget("%var_ssbo_sb"); + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), Eq("")); +} + +TEST_F(ValidateDecorations, NonWritableMemberOfSsboInStorageBufferGood) { + std::string spirv = ShaderWithNonWritableTarget("%struct_b_rtarr", true); + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), Eq("")); +} + +TEST_F(ValidateDecorations, NonWritableMemberOfNonBlockStructBad) { + std::string spirv = ShaderWithNonWritableTarget("%struct_bad", true); + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT( + getDiagnosticString(), + HasSubstr("Target of NonWritable member decoration is invalid: must be " + "the struct type of a uniform block or storage buffer")); +} + +TEST_F(ValidateDecorations, NonWritableVarWorkgroupBad) { + std::string spirv = ShaderWithNonWritableTarget("%var_wg"); + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Target of NonWritable decoration is invalid: must " + "point to a storage image, uniform block, or storage " + "buffer\n %var_wg")); +} + +TEST_F(ValidateDecorations, NonWritableVarPrivateBad) { + std::string spirv = ShaderWithNonWritableTarget("%var_priv"); + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Target of NonWritable decoration is invalid: must " + "point to a storage image, uniform block, or storage " + "buffer\n %var_priv")); +} + +TEST_F(ValidateDecorations, NonWritableVarFunctionBad) { + std::string spirv = ShaderWithNonWritableTarget("%var_func"); + + CompileSuccessfully(spirv); + EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions()); + EXPECT_THAT(getDiagnosticString(), + HasSubstr("Target of NonWritable decoration is invalid: must " + "point to a storage image, uniform block, or storage " + "buffer\n %var_func")); +} + +TEST_P(ValidateWebGPUCombineDecorationResult, Decorate) { + const char* const decoration = std::get<0>(GetParam()); + const TestResult& test_result = std::get<1>(GetParam()); + + CodeGenerator generator = CodeGenerator::GetWebGPUShaderCodeGenerator(); + generator.before_types_ = "OpDecorate %u32 "; + generator.before_types_ += decoration; + generator.before_types_ += "\n"; + + EntryPoint entry_point; + entry_point.name = "main"; + entry_point.execution_model = "Vertex"; + generator.entry_points_.push_back(std::move(entry_point)); + + CompileSuccessfully(generator.Build(), SPV_ENV_WEBGPU_0); + ASSERT_EQ(test_result.validation_result, + ValidateInstructions(SPV_ENV_WEBGPU_0)); + if (test_result.error_str != "") { + EXPECT_THAT(getDiagnosticString(), HasSubstr(test_result.error_str)); + } +} + +TEST_P(ValidateWebGPUCombineDecorationResult, DecorateMember) { + const char* const decoration = std::get<0>(GetParam()); + const TestResult& test_result = std::get<1>(GetParam()); + + CodeGenerator generator = CodeGenerator::GetWebGPUShaderCodeGenerator(); + generator.before_types_ = "OpMemberDecorate %struct_type 0 "; + generator.before_types_ += decoration; + generator.before_types_ += "\n"; + + generator.after_types_ = "%struct_type = OpTypeStruct %u32\n"; + + EntryPoint entry_point; + entry_point.name = "main"; + entry_point.execution_model = "Vertex"; + generator.entry_points_.push_back(std::move(entry_point)); + + CompileSuccessfully(generator.Build(), SPV_ENV_WEBGPU_0); + ASSERT_EQ(test_result.validation_result, + ValidateInstructions(SPV_ENV_WEBGPU_0)); + if (!test_result.error_str.empty()) { + EXPECT_THAT(getDiagnosticString(), HasSubstr(test_result.error_str)); + } +} + +INSTANTIATE_TEST_SUITE_P( + DecorationCapabilityFailure, ValidateWebGPUCombineDecorationResult, + Combine(Values("CPacked", "Patch", "Sample", "Constant", + "SaturatedConversion", "NonUniformEXT"), + Values(TestResult(SPV_ERROR_INVALID_CAPABILITY, + "requires one of these capabilities")))); + +INSTANTIATE_TEST_SUITE_P( + DecorationWhitelistFailure, ValidateWebGPUCombineDecorationResult, + Combine(Values("RelaxedPrecision", "BufferBlock", "GLSLShared", + "GLSLPacked", "Invariant", "Volatile", "Coherent"), + Values(TestResult( + SPV_ERROR_INVALID_ID, + "is not valid for the WebGPU execution environment.")))); + } // namespace } // namespace val } // namespace spvtools diff --git a/3rdparty/spirv-tools/test/val/val_ext_inst_test.cpp b/3rdparty/spirv-tools/test/val/val_ext_inst_test.cpp index d1505da45..e5ff3926e 100644 --- a/3rdparty/spirv-tools/test/val/val_ext_inst_test.cpp +++ b/3rdparty/spirv-tools/test/val/val_ext_inst_test.cpp @@ -493,20 +493,20 @@ TEST_P(ValidateGlslStd450SqrtLike, IntOperand) { "Result Type")); } -INSTANTIATE_TEST_CASE_P(AllSqrtLike, ValidateGlslStd450SqrtLike, - ::testing::ValuesIn(std::vector{ - "Round", - "RoundEven", - "FAbs", - "Trunc", - "FSign", - "Floor", - "Ceil", - "Fract", - "Sqrt", - "InverseSqrt", - "Normalize", - }), ); +INSTANTIATE_TEST_SUITE_P(AllSqrtLike, ValidateGlslStd450SqrtLike, + ::testing::ValuesIn(std::vector{ + "Round", + "RoundEven", + "FAbs", + "Trunc", + "FSign", + "Floor", + "Ceil", + "Fract", + "Sqrt", + "InverseSqrt", + "Normalize", + })); TEST_P(ValidateGlslStd450FMinLike, Success) { const std::string ext_inst_name = GetParam(); @@ -560,15 +560,15 @@ TEST_P(ValidateGlslStd450FMinLike, IntOperand2) { "Result Type")); } -INSTANTIATE_TEST_CASE_P(AllFMinLike, ValidateGlslStd450FMinLike, - ::testing::ValuesIn(std::vector{ - "FMin", - "FMax", - "Step", - "Reflect", - "NMin", - "NMax", - }), ); +INSTANTIATE_TEST_SUITE_P(AllFMinLike, ValidateGlslStd450FMinLike, + ::testing::ValuesIn(std::vector{ + "FMin", + "FMax", + "Step", + "Reflect", + "NMin", + "NMax", + })); TEST_P(ValidateGlslStd450FClampLike, Success) { const std::string ext_inst_name = GetParam(); @@ -635,15 +635,15 @@ TEST_P(ValidateGlslStd450FClampLike, IntOperand3) { "Result Type")); } -INSTANTIATE_TEST_CASE_P(AllFClampLike, ValidateGlslStd450FClampLike, - ::testing::ValuesIn(std::vector{ - "FClamp", - "FMix", - "SmoothStep", - "Fma", - "FaceForward", - "NClamp", - }), ); +INSTANTIATE_TEST_SUITE_P(AllFClampLike, ValidateGlslStd450FClampLike, + ::testing::ValuesIn(std::vector{ + "FClamp", + "FMix", + "SmoothStep", + "Fma", + "FaceForward", + "NClamp", + })); TEST_P(ValidateGlslStd450SAbsLike, Success) { const std::string ext_inst_name = GetParam(); @@ -716,14 +716,14 @@ TEST_P(ValidateGlslStd450SAbsLike, WrongBitWidthOperand) { "Result Type")); } -INSTANTIATE_TEST_CASE_P(AllSAbsLike, ValidateGlslStd450SAbsLike, - ::testing::ValuesIn(std::vector{ - "SAbs", - "SSign", - "FindILsb", - "FindUMsb", - "FindSMsb", - }), ); +INSTANTIATE_TEST_SUITE_P(AllSAbsLike, ValidateGlslStd450SAbsLike, + ::testing::ValuesIn(std::vector{ + "SAbs", + "SSign", + "FindILsb", + "FindUMsb", + "FindSMsb", + })); TEST_F(ValidateExtInst, FindUMsbNot32Bit) { const std::string body = R"( @@ -865,13 +865,13 @@ TEST_P(ValidateGlslStd450UMinLike, WrongBitWidthOperand2) { "Result Type")); } -INSTANTIATE_TEST_CASE_P(AllUMinLike, ValidateGlslStd450UMinLike, - ::testing::ValuesIn(std::vector{ - "UMin", - "SMin", - "UMax", - "SMax", - }), ); +INSTANTIATE_TEST_SUITE_P(AllUMinLike, ValidateGlslStd450UMinLike, + ::testing::ValuesIn(std::vector{ + "UMin", + "SMin", + "UMax", + "SMax", + })); TEST_P(ValidateGlslStd450UClampLike, Success) { const std::string ext_inst_name = GetParam(); @@ -1028,11 +1028,11 @@ TEST_P(ValidateGlslStd450UClampLike, WrongBitWidthOperand3) { "Result Type")); } -INSTANTIATE_TEST_CASE_P(AllUClampLike, ValidateGlslStd450UClampLike, - ::testing::ValuesIn(std::vector{ - "UClamp", - "SClamp", - }), ); +INSTANTIATE_TEST_SUITE_P(AllUClampLike, ValidateGlslStd450UClampLike, + ::testing::ValuesIn(std::vector{ + "UClamp", + "SClamp", + })); TEST_P(ValidateGlslStd450SinLike, Success) { const std::string ext_inst_name = GetParam(); @@ -1083,27 +1083,27 @@ TEST_P(ValidateGlslStd450SinLike, IntOperand) { "Result Type")); } -INSTANTIATE_TEST_CASE_P(AllSinLike, ValidateGlslStd450SinLike, - ::testing::ValuesIn(std::vector{ - "Radians", - "Degrees", - "Sin", - "Cos", - "Tan", - "Asin", - "Acos", - "Atan", - "Sinh", - "Cosh", - "Tanh", - "Asinh", - "Acosh", - "Atanh", - "Exp", - "Exp2", - "Log", - "Log2", - }), ); +INSTANTIATE_TEST_SUITE_P(AllSinLike, ValidateGlslStd450SinLike, + ::testing::ValuesIn(std::vector{ + "Radians", + "Degrees", + "Sin", + "Cos", + "Tan", + "Asin", + "Acos", + "Atan", + "Sinh", + "Cosh", + "Tanh", + "Asinh", + "Acosh", + "Atanh", + "Exp", + "Exp2", + "Log", + "Log2", + })); TEST_P(ValidateGlslStd450PowLike, Success) { const std::string ext_inst_name = GetParam(); @@ -1168,11 +1168,11 @@ TEST_P(ValidateGlslStd450PowLike, IntOperand2) { "Result Type")); } -INSTANTIATE_TEST_CASE_P(AllPowLike, ValidateGlslStd450PowLike, - ::testing::ValuesIn(std::vector{ - "Atan2", - "Pow", - }), ); +INSTANTIATE_TEST_SUITE_P(AllPowLike, ValidateGlslStd450PowLike, + ::testing::ValuesIn(std::vector{ + "Atan2", + "Pow", + })); TEST_F(ValidateExtInst, GlslStd450DeterminantSuccess) { const std::string body = R"( @@ -1795,14 +1795,14 @@ TEST_P(ValidateGlslStd450Pack, VWrongSizeVector) { EXPECT_THAT(getDiagnosticString(), HasSubstr(expected.str())); } -INSTANTIATE_TEST_CASE_P(AllPack, ValidateGlslStd450Pack, - ::testing::ValuesIn(std::vector{ - "PackSnorm4x8", - "PackUnorm4x8", - "PackSnorm2x16", - "PackUnorm2x16", - "PackHalf2x16", - }), ); +INSTANTIATE_TEST_SUITE_P(AllPack, ValidateGlslStd450Pack, + ::testing::ValuesIn(std::vector{ + "PackSnorm4x8", + "PackUnorm4x8", + "PackSnorm2x16", + "PackUnorm2x16", + "PackHalf2x16", + })); TEST_F(ValidateExtInst, PackDouble2x32Success) { const std::string body = R"( @@ -2034,14 +2034,14 @@ TEST_P(ValidateGlslStd450Unpack, ResultPWrongBitWidth) { EXPECT_THAT(getDiagnosticString(), HasSubstr(expected.str())); } -INSTANTIATE_TEST_CASE_P(AllUnpack, ValidateGlslStd450Unpack, - ::testing::ValuesIn(std::vector{ - "UnpackSnorm4x8", - "UnpackUnorm4x8", - "UnpackSnorm2x16", - "UnpackUnorm2x16", - "UnpackHalf2x16", - }), ); +INSTANTIATE_TEST_SUITE_P(AllUnpack, ValidateGlslStd450Unpack, + ::testing::ValuesIn(std::vector{ + "UnpackSnorm4x8", + "UnpackUnorm4x8", + "UnpackSnorm2x16", + "UnpackUnorm2x16", + "UnpackHalf2x16", + })); TEST_F(ValidateExtInst, UnpackDouble2x32Success) { const std::string body = R"( @@ -2831,7 +2831,7 @@ TEST_P(ValidateOpenCLStdSqrtLike, IntOperand) { "Result Type")); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( AllSqrtLike, ValidateOpenCLStdSqrtLike, ::testing::ValuesIn(std::vector{ "acos", "acosh", "acospi", "asin", @@ -2851,7 +2851,7 @@ INSTANTIATE_TEST_CASE_P( "native_log", "native_log2", "native_log10", "native_recip", "native_rsqrt", "native_sin", "native_sqrt", "native_tan", "degrees", "radians", "sign", - }), ); + })); TEST_P(ValidateOpenCLStdFMinLike, Success) { const std::string ext_inst_name = GetParam(); @@ -2905,16 +2905,16 @@ TEST_P(ValidateOpenCLStdFMinLike, IntOperand2) { "Result Type")); } -INSTANTIATE_TEST_CASE_P(AllFMinLike, ValidateOpenCLStdFMinLike, - ::testing::ValuesIn(std::vector{ - "atan2", "atan2pi", "copysign", - "fdim", "fmax", "fmin", - "fmod", "maxmag", "minmag", - "hypot", "nextafter", "pow", - "powr", "remainder", "half_divide", - "half_powr", "native_divide", "native_powr", - "step", "fmax_common", "fmin_common", - }), ); +INSTANTIATE_TEST_SUITE_P(AllFMinLike, ValidateOpenCLStdFMinLike, + ::testing::ValuesIn(std::vector{ + "atan2", "atan2pi", "copysign", + "fdim", "fmax", "fmin", + "fmod", "maxmag", "minmag", + "hypot", "nextafter", "pow", + "powr", "remainder", "half_divide", + "half_powr", "native_divide", "native_powr", + "step", "fmax_common", "fmin_common", + })); TEST_P(ValidateOpenCLStdFClampLike, Success) { const std::string ext_inst_name = GetParam(); @@ -2981,14 +2981,14 @@ TEST_P(ValidateOpenCLStdFClampLike, IntOperand3) { "Result Type")); } -INSTANTIATE_TEST_CASE_P(AllFClampLike, ValidateOpenCLStdFClampLike, - ::testing::ValuesIn(std::vector{ - "fma", - "mad", - "fclamp", - "mix", - "smoothstep", - }), ); +INSTANTIATE_TEST_SUITE_P(AllFClampLike, ValidateOpenCLStdFClampLike, + ::testing::ValuesIn(std::vector{ + "fma", + "mad", + "fclamp", + "mix", + "smoothstep", + })); TEST_P(ValidateOpenCLStdSAbsLike, Success) { const std::string ext_inst_name = GetParam(); @@ -3048,14 +3048,14 @@ TEST_P(ValidateOpenCLStdSAbsLike, U64Operand) { ": expected types of all operands to be equal to Result Type")); } -INSTANTIATE_TEST_CASE_P(AllSAbsLike, ValidateOpenCLStdSAbsLike, - ::testing::ValuesIn(std::vector{ - "s_abs", - "clz", - "ctz", - "popcount", - "u_abs", - }), ); +INSTANTIATE_TEST_SUITE_P(AllSAbsLike, ValidateOpenCLStdSAbsLike, + ::testing::ValuesIn(std::vector{ + "s_abs", + "clz", + "ctz", + "popcount", + "u_abs", + })); TEST_P(ValidateOpenCLStdUMinLike, Success) { const std::string ext_inst_name = GetParam(); @@ -3147,26 +3147,26 @@ TEST_P(ValidateOpenCLStdUMinLike, U64Operand2) { ": expected types of all operands to be equal to Result Type")); } -INSTANTIATE_TEST_CASE_P(AllUMinLike, ValidateOpenCLStdUMinLike, - ::testing::ValuesIn(std::vector{ - "s_max", - "u_max", - "s_min", - "u_min", - "s_abs_diff", - "s_add_sat", - "u_add_sat", - "s_mul_hi", - "rotate", - "s_sub_sat", - "u_sub_sat", - "s_hadd", - "u_hadd", - "s_rhadd", - "u_rhadd", - "u_abs_diff", - "u_mul_hi", - }), ); +INSTANTIATE_TEST_SUITE_P(AllUMinLike, ValidateOpenCLStdUMinLike, + ::testing::ValuesIn(std::vector{ + "s_max", + "u_max", + "s_min", + "u_min", + "s_abs_diff", + "s_add_sat", + "u_add_sat", + "s_mul_hi", + "rotate", + "s_sub_sat", + "u_sub_sat", + "s_hadd", + "u_hadd", + "s_rhadd", + "u_rhadd", + "u_abs_diff", + "u_mul_hi", + })); TEST_P(ValidateOpenCLStdUClampLike, Success) { const std::string ext_inst_name = GetParam(); @@ -3284,15 +3284,15 @@ TEST_P(ValidateOpenCLStdUClampLike, U64Operand3) { ": expected types of all operands to be equal to Result Type")); } -INSTANTIATE_TEST_CASE_P(AllUClampLike, ValidateOpenCLStdUClampLike, - ::testing::ValuesIn(std::vector{ - "s_clamp", - "u_clamp", - "s_mad_hi", - "u_mad_sat", - "s_mad_sat", - "u_mad_hi", - }), ); +INSTANTIATE_TEST_SUITE_P(AllUClampLike, ValidateOpenCLStdUClampLike, + ::testing::ValuesIn(std::vector{ + "s_clamp", + "u_clamp", + "s_mad_hi", + "u_mad_sat", + "s_mad_sat", + "u_mad_hi", + })); // ------------------------------------------------------------- TEST_P(ValidateOpenCLStdUMul24Like, Success) { @@ -3398,11 +3398,11 @@ TEST_P(ValidateOpenCLStdUMul24Like, U64Operand2) { ": expected types of all operands to be equal to Result Type")); } -INSTANTIATE_TEST_CASE_P(AllUMul24Like, ValidateOpenCLStdUMul24Like, - ::testing::ValuesIn(std::vector{ - "s_mul24", - "u_mul24", - }), ); +INSTANTIATE_TEST_SUITE_P(AllUMul24Like, ValidateOpenCLStdUMul24Like, + ::testing::ValuesIn(std::vector{ + "s_mul24", + "u_mul24", + })); TEST_P(ValidateOpenCLStdUMad24Like, Success) { const std::string ext_inst_name = GetParam(); @@ -3533,11 +3533,11 @@ TEST_P(ValidateOpenCLStdUMad24Like, U64Operand3) { ": expected types of all operands to be equal to Result Type")); } -INSTANTIATE_TEST_CASE_P(AllUMad24Like, ValidateOpenCLStdUMad24Like, - ::testing::ValuesIn(std::vector{ - "s_mad24", - "u_mad24", - }), ); +INSTANTIATE_TEST_SUITE_P(AllUMad24Like, ValidateOpenCLStdUMad24Like, + ::testing::ValuesIn(std::vector{ + "s_mad24", + "u_mad24", + })); TEST_F(ValidateExtInst, OpenCLStdCrossSuccess) { const std::string body = R"( @@ -3662,11 +3662,11 @@ TEST_P(ValidateOpenCLStdLengthLike, DifferentType) { "Result Type")); } -INSTANTIATE_TEST_CASE_P(AllLengthLike, ValidateOpenCLStdLengthLike, - ::testing::ValuesIn(std::vector{ - "length", - "fast_length", - }), ); +INSTANTIATE_TEST_SUITE_P(AllLengthLike, ValidateOpenCLStdLengthLike, + ::testing::ValuesIn(std::vector{ + "length", + "fast_length", + })); TEST_P(ValidateOpenCLStdDistanceLike, Success) { const std::string ext_inst_name = GetParam(); @@ -3751,11 +3751,11 @@ TEST_P(ValidateOpenCLStdDistanceLike, DifferentOperands) { "expected operands P0 and P1 to be of the same type")); } -INSTANTIATE_TEST_CASE_P(AllDistanceLike, ValidateOpenCLStdDistanceLike, - ::testing::ValuesIn(std::vector{ - "distance", - "fast_distance", - }), ); +INSTANTIATE_TEST_SUITE_P(AllDistanceLike, ValidateOpenCLStdDistanceLike, + ::testing::ValuesIn(std::vector{ + "distance", + "fast_distance", + })); TEST_P(ValidateOpenCLStdNormalizeLike, Success) { const std::string ext_inst_name = GetParam(); @@ -3811,11 +3811,11 @@ TEST_P(ValidateOpenCLStdNormalizeLike, DifferentType) { "expected operand P type to be equal to Result Type")); } -INSTANTIATE_TEST_CASE_P(AllNormalizeLike, ValidateOpenCLStdNormalizeLike, - ::testing::ValuesIn(std::vector{ - "normalize", - "fast_normalize", - }), ); +INSTANTIATE_TEST_SUITE_P(AllNormalizeLike, ValidateOpenCLStdNormalizeLike, + ::testing::ValuesIn(std::vector{ + "normalize", + "fast_normalize", + })); TEST_F(ValidateExtInst, OpenCLStdBitselectSuccess) { const std::string body = R"( @@ -4208,15 +4208,15 @@ TEST_P(ValidateOpenCLStdVStoreHalfLike, PDataTypeFloat32) { ": expected operand P data type to be 16-bit float scalar")); } -INSTANTIATE_TEST_CASE_P(AllVStoreHalfLike, ValidateOpenCLStdVStoreHalfLike, - ::testing::ValuesIn(std::vector{ - "vstore_half", - "vstore_half_r", - "vstore_halfn", - "vstore_halfn_r", - "vstorea_halfn", - "vstorea_halfn_r", - }), ); +INSTANTIATE_TEST_SUITE_P(AllVStoreHalfLike, ValidateOpenCLStdVStoreHalfLike, + ::testing::ValuesIn(std::vector{ + "vstore_half", + "vstore_half_r", + "vstore_halfn", + "vstore_halfn_r", + "vstorea_halfn", + "vstorea_halfn_r", + })); TEST_P(ValidateOpenCLStdVLoadHalfLike, SuccessPhysical32) { const std::string ext_inst_name = GetParam(); @@ -4375,11 +4375,11 @@ TEST_P(ValidateOpenCLStdVLoadHalfLike, WrongN) { "components of Result Type")); } -INSTANTIATE_TEST_CASE_P(AllVLoadHalfLike, ValidateOpenCLStdVLoadHalfLike, - ::testing::ValuesIn(std::vector{ - "vload_halfn", - "vloada_halfn", - }), ); +INSTANTIATE_TEST_SUITE_P(AllVLoadHalfLike, ValidateOpenCLStdVLoadHalfLike, + ::testing::ValuesIn(std::vector{ + "vload_halfn", + "vloada_halfn", + })); TEST_F(ValidateExtInst, VLoadNSuccessFloatPhysical32) { std::ostringstream ss; @@ -5299,12 +5299,12 @@ TEST_P(ValidateOpenCLStdFractLike, PointerWrongDataType) { ": expected data type of the pointer to be equal to Result Type")); } -INSTANTIATE_TEST_CASE_P(AllFractLike, ValidateOpenCLStdFractLike, - ::testing::ValuesIn(std::vector{ - "fract", - "modf", - "sincos", - }), ); +INSTANTIATE_TEST_SUITE_P(AllFractLike, ValidateOpenCLStdFractLike, + ::testing::ValuesIn(std::vector{ + "fract", + "modf", + "sincos", + })); TEST_F(ValidateExtInst, OpenCLStdRemquoSuccess) { const std::string body = R"( @@ -5518,11 +5518,11 @@ TEST_P(ValidateOpenCLStdFrexpLike, PointerDataTypeDiffSize) { "number of components as Result Type")); } -INSTANTIATE_TEST_CASE_P(AllFrexpLike, ValidateOpenCLStdFrexpLike, - ::testing::ValuesIn(std::vector{ - "frexp", - "lgamma_r", - }), ); +INSTANTIATE_TEST_SUITE_P(AllFrexpLike, ValidateOpenCLStdFrexpLike, + ::testing::ValuesIn(std::vector{ + "frexp", + "lgamma_r", + })); TEST_F(ValidateExtInst, OpenCLStdIlogbSuccess) { const std::string body = R"( @@ -5716,12 +5716,12 @@ TEST_P(ValidateOpenCLStdLdexpLike, ExponentWrongSize) { "components as Result Type")); } -INSTANTIATE_TEST_CASE_P(AllLdexpLike, ValidateOpenCLStdLdexpLike, - ::testing::ValuesIn(std::vector{ - "ldexp", - "pown", - "rootn", - }), ); +INSTANTIATE_TEST_SUITE_P(AllLdexpLike, ValidateOpenCLStdLdexpLike, + ::testing::ValuesIn(std::vector{ + "ldexp", + "pown", + "rootn", + })); TEST_P(ValidateOpenCLStdUpsampleLike, Success) { const std::string ext_inst_name = GetParam(); @@ -5808,11 +5808,11 @@ TEST_P(ValidateOpenCLStdUpsampleLike, HiLoWrongBitWidth) { "be half of the bit width of components of Result Type")); } -INSTANTIATE_TEST_CASE_P(AllUpsampleLike, ValidateOpenCLStdUpsampleLike, - ::testing::ValuesIn(std::vector{ - "u_upsample", - "s_upsample", - }), ); +INSTANTIATE_TEST_SUITE_P(AllUpsampleLike, ValidateOpenCLStdUpsampleLike, + ::testing::ValuesIn(std::vector{ + "u_upsample", + "s_upsample", + })); } // namespace } // namespace val diff --git a/3rdparty/spirv-tools/test/val/val_extensions_test.cpp b/3rdparty/spirv-tools/test/val/val_extensions_test.cpp index 3d6466d5c..52ce3829c 100644 --- a/3rdparty/spirv-tools/test/val/val_extensions_test.cpp +++ b/3rdparty/spirv-tools/test/val/val_extensions_test.cpp @@ -43,7 +43,7 @@ std::string GetErrorString(const std::string& extension) { return "Found unrecognized extension " + extension; } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ExpectSuccess, ValidateKnownExtensions, Values( // Match the order as published on the SPIR-V Registry. @@ -64,9 +64,9 @@ INSTANTIATE_TEST_CASE_P( "SPV_GOOGLE_decorate_string", "SPV_GOOGLE_hlsl_functionality1", "SPV_NV_shader_subgroup_partitioned", "SPV_EXT_descriptor_indexing")); -INSTANTIATE_TEST_CASE_P(FailSilently, ValidateUnknownExtensions, - Values("ERROR_unknown_extension", "SPV_KHR_", - "SPV_KHR_shader_ballot_ERROR")); +INSTANTIATE_TEST_SUITE_P(FailSilently, ValidateUnknownExtensions, + Values("ERROR_unknown_extension", "SPV_KHR_", + "SPV_KHR_shader_ballot_ERROR")); TEST_P(ValidateKnownExtensions, ExpectSuccess) { const std::string extension = GetParam(); @@ -227,8 +227,8 @@ TEST_P(ValidateAMDShaderBallotCapabilities, ExpectSuccess) { EXPECT_EQ(SPV_SUCCESS, ValidateInstructions()) << getDiagnosticString(); } -INSTANTIATE_TEST_CASE_P(ExpectSuccess, ValidateAMDShaderBallotCapabilities, - ValuesIn(AMDShaderBallotGroupInstructions())); +INSTANTIATE_TEST_SUITE_P(ExpectSuccess, ValidateAMDShaderBallotCapabilities, + ValuesIn(AMDShaderBallotGroupInstructions())); TEST_P(ValidateAMDShaderBallotCapabilities, ExpectFailure) { // Fail because the module does not specify the SPV_AMD_shader_ballot @@ -251,8 +251,8 @@ TEST_P(ValidateAMDShaderBallotCapabilities, ExpectFailure) { " requires one of these capabilities: Groups"))); } -INSTANTIATE_TEST_CASE_P(ExpectFailure, ValidateAMDShaderBallotCapabilities, - ValuesIn(AMDShaderBallotGroupInstructions())); +INSTANTIATE_TEST_SUITE_P(ExpectFailure, ValidateAMDShaderBallotCapabilities, + ValuesIn(AMDShaderBallotGroupInstructions())); struct ExtIntoCoreCase { const char* ext; @@ -305,7 +305,7 @@ TEST_P(ValidateExtIntoCore, DoNotAskForExtensionInLaterVersion) { } // clang-format off -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( KHR_extensions, ValidateExtIntoCore, ValuesIn(std::vector{ // SPV_KHR_shader_draw_parameters became core SPIR-V 1.3 diff --git a/3rdparty/spirv-tools/test/val/val_id_test.cpp b/3rdparty/spirv-tools/test/val/val_id_test.cpp index a09761e02..9910a09dd 100644 --- a/3rdparty/spirv-tools/test/val/val_id_test.cpp +++ b/3rdparty/spirv-tools/test/val/val_id_test.cpp @@ -857,8 +857,8 @@ TEST_P(OpTypeArrayLengthTest, LengthNegative) { // capability prohibits usage of signed integers, we can skip 8-bit integers // here since the purpose of these tests is to check the validity of // OpTypeArray, not OpTypeInt. -INSTANTIATE_TEST_CASE_P(Widths, OpTypeArrayLengthTest, - ValuesIn(std::vector{16, 32, 64})); +INSTANTIATE_TEST_SUITE_P(Widths, OpTypeArrayLengthTest, + ValuesIn(std::vector{16, 32, 64})); TEST_F(ValidateIdWithMessage, OpTypeArrayLengthNull) { std::string spirv = kGLSL450MemoryModel + R"( @@ -3918,7 +3918,7 @@ OpFunctionEnd } // Run tests for Access Chain Instructions. -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( CheckAccessChainInstructions, AccessChainInstructionTest, ::testing::Values("OpAccessChain", "OpInBoundsAccessChain", "OpPtrAccessChain", "OpInBoundsPtrAccessChain")); diff --git a/3rdparty/spirv-tools/test/val/val_layout_test.cpp b/3rdparty/spirv-tools/test/val/val_layout_test.cpp index e502d8c24..9d4491c37 100644 --- a/3rdparty/spirv-tools/test/val/val_layout_test.cpp +++ b/3rdparty/spirv-tools/test/val/val_layout_test.cpp @@ -120,7 +120,7 @@ const std::vector& getInstructions() { static const int kRangeEnd = 1000; pred_type All = Range<0, kRangeEnd>(); -INSTANTIATE_TEST_CASE_P(InstructionsOrder, +INSTANTIATE_TEST_SUITE_P(InstructionsOrder, ValidateLayout, ::testing::Combine(::testing::Range((int)0, (int)getInstructions().size()), // Note: Because of ID dependencies between instructions, some instructions @@ -160,7 +160,7 @@ INSTANTIATE_TEST_CASE_P(InstructionsOrder, , std::make_tuple(std::string("%fLabel = OpLabel") , Equals<39> , All) , std::make_tuple(std::string("OpNop") , Equals<40> , Range<40,kRangeEnd>()) , std::make_tuple(std::string("OpReturn ; %func2 return") , Equals<41> , All) - )),); + ))); // clang-format on // Creates a new vector which removes the string if the substr is found in the @@ -181,7 +181,7 @@ std::vector GenerateCode(std::string substr, int order) { } // This test will check the logical layout of a binary by removing each -// instruction in the pair of the INSTANTIATE_TEST_CASE_P call and moving it in +// instruction in the pair of the INSTANTIATE_TEST_SUITE_P call and moving it in // the SPIRV source formed by combining the vector "instructions". TEST_P(ValidateLayout, Layout) { int order; diff --git a/3rdparty/spirv-tools/test/val/val_literals_test.cpp b/3rdparty/spirv-tools/test/val/val_literals_test.cpp index cbdbdd10e..4ef6186ef 100644 --- a/3rdparty/spirv-tools/test/val/val_literals_test.cpp +++ b/3rdparty/spirv-tools/test/val/val_literals_test.cpp @@ -99,7 +99,7 @@ TEST_P(ValidateLiteralsShader, LiteralsShaderBad) { "or sign extended when Signedness is 1")); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( LiteralsShaderCases, ValidateLiteralsShader, ::testing::Values("%11 = OpConstant %int16 !0xFFFF0000", // Sign bit is 0 "%11 = OpConstant %int16 !0x00008000", // Sign bit is 1 @@ -132,7 +132,7 @@ TEST_P(ValidateLiteralsKernel, LiteralsKernelBad) { "or sign extended when Signedness is 1")); } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( LiteralsKernelCases, ValidateLiteralsKernel, ::testing::Values("%2 = OpConstant %uint8 !0xABCDEF00", "%2 = OpConstant %uint8 !0xABCDEFFF")); diff --git a/3rdparty/spirv-tools/test/val/val_memory_test.cpp b/3rdparty/spirv-tools/test/val/val_memory_test.cpp index 9ebbac0cb..b567a7bba 100644 --- a/3rdparty/spirv-tools/test/val/val_memory_test.cpp +++ b/3rdparty/spirv-tools/test/val/val_memory_test.cpp @@ -2101,7 +2101,7 @@ OpEntryPoint Fragment %func "func" OpExecutionMode %func OriginUpperLeft OpDecorate %array_t ArrayStride 4 OpMemberDecorate %struct_t 0 Offset 0 -OpDecorate %struct_t BufferBlock +OpDecorate %struct_t Block %uint_t = OpTypeInt 32 0 %array_t = OpTypeRuntimeArray %uint_t %struct_t = OpTypeStruct %array_t diff --git a/3rdparty/spirv-tools/test/val/val_modes_test.cpp b/3rdparty/spirv-tools/test/val/val_modes_test.cpp index 7f1ef093d..41d42eed8 100644 --- a/3rdparty/spirv-tools/test/val/val_modes_test.cpp +++ b/3rdparty/spirv-tools/test/val/val_modes_test.cpp @@ -510,7 +510,7 @@ TEST_P(ValidateModeGeometry, ExecutionMode) { } } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( GeometryRequiredModes, ValidateModeGeometry, Combine(Combine(Values("InputPoints", ""), Values("InputLines", ""), Values("InputLinesAdjacency", ""), Values("Triangles", ""), @@ -584,7 +584,7 @@ TEST_P(ValidateModeExecution, ExecutionMode) { } } -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ValidateModeGeometryOnlyGoodSpv10, ValidateModeExecution, Combine(Values(SPV_SUCCESS), Values(""), Values("Geometry"), Values("Invocations 3", "InputPoints", "InputLines", @@ -592,7 +592,7 @@ INSTANTIATE_TEST_CASE_P( "OutputPoints", "OutputLineStrip", "OutputTriangleStrip"), Values(SPV_ENV_UNIVERSAL_1_0))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ValidateModeGeometryOnlyBadSpv10, ValidateModeExecution, Combine(Values(SPV_ERROR_INVALID_DATA), Values("Execution mode can only be used with the Geometry " @@ -604,7 +604,7 @@ INSTANTIATE_TEST_CASE_P( "OutputPoints", "OutputLineStrip", "OutputTriangleStrip"), Values(SPV_ENV_UNIVERSAL_1_0))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ValidateModeTessellationOnlyGoodSpv10, ValidateModeExecution, Combine(Values(SPV_SUCCESS), Values(""), Values("TessellationControl", "TessellationEvaluation"), @@ -613,7 +613,7 @@ INSTANTIATE_TEST_CASE_P( "PointMode", "Quads", "Isolines"), Values(SPV_ENV_UNIVERSAL_1_0))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ValidateModeTessellationOnlyBadSpv10, ValidateModeExecution, Combine(Values(SPV_ERROR_INVALID_DATA), Values("Execution mode can only be used with a tessellation " @@ -624,15 +624,15 @@ INSTANTIATE_TEST_CASE_P( "PointMode", "Quads", "Isolines"), Values(SPV_ENV_UNIVERSAL_1_0))); -INSTANTIATE_TEST_CASE_P(ValidateModeGeometryAndTessellationGoodSpv10, - ValidateModeExecution, - Combine(Values(SPV_SUCCESS), Values(""), - Values("TessellationControl", - "TessellationEvaluation", "Geometry"), - Values("Triangles", "OutputVertices 3"), - Values(SPV_ENV_UNIVERSAL_1_0))); +INSTANTIATE_TEST_SUITE_P(ValidateModeGeometryAndTessellationGoodSpv10, + ValidateModeExecution, + Combine(Values(SPV_SUCCESS), Values(""), + Values("TessellationControl", + "TessellationEvaluation", "Geometry"), + Values("Triangles", "OutputVertices 3"), + Values(SPV_ENV_UNIVERSAL_1_0))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ValidateModeGeometryAndTessellationBadSpv10, ValidateModeExecution, Combine(Values(SPV_ERROR_INVALID_DATA), Values("Execution mode can only be used with a Geometry or " @@ -641,7 +641,7 @@ INSTANTIATE_TEST_CASE_P( Values("Triangles", "OutputVertices 3"), Values(SPV_ENV_UNIVERSAL_1_0))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ValidateModeFragmentOnlyGoodSpv10, ValidateModeExecution, Combine(Values(SPV_SUCCESS), Values(""), Values("Fragment"), Values("PixelCenterInteger", "OriginUpperLeft", "OriginLowerLeft", @@ -649,7 +649,7 @@ INSTANTIATE_TEST_CASE_P( "DepthUnchanged"), Values(SPV_ENV_UNIVERSAL_1_0))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ValidateModeFragmentOnlyBadSpv10, ValidateModeExecution, Combine(Values(SPV_ERROR_INVALID_DATA), Values("Execution mode can only be used with the Fragment " @@ -661,15 +661,15 @@ INSTANTIATE_TEST_CASE_P( "DepthUnchanged"), Values(SPV_ENV_UNIVERSAL_1_0))); -INSTANTIATE_TEST_CASE_P(ValidateModeKernelOnlyGoodSpv13, ValidateModeExecution, - Combine(Values(SPV_SUCCESS), Values(""), - Values("Kernel"), - Values("LocalSizeHint 1 1 1", "VecTypeHint 4", - "ContractionOff", - "LocalSizeHintId %int1"), - Values(SPV_ENV_UNIVERSAL_1_3))); +INSTANTIATE_TEST_SUITE_P(ValidateModeKernelOnlyGoodSpv13, ValidateModeExecution, + Combine(Values(SPV_SUCCESS), Values(""), + Values("Kernel"), + Values("LocalSizeHint 1 1 1", "VecTypeHint 4", + "ContractionOff", + "LocalSizeHintId %int1"), + Values(SPV_ENV_UNIVERSAL_1_3))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ValidateModeKernelOnlyBadSpv13, ValidateModeExecution, Combine( Values(SPV_ERROR_INVALID_DATA), @@ -681,13 +681,13 @@ INSTANTIATE_TEST_CASE_P( "LocalSizeHintId %int1"), Values(SPV_ENV_UNIVERSAL_1_3))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ValidateModeGLComputeAndKernelGoodSpv13, ValidateModeExecution, Combine(Values(SPV_SUCCESS), Values(""), Values("Kernel", "GLCompute"), Values("LocalSize 1 1 1", "LocalSizeId %int1 %int1 %int1"), Values(SPV_ENV_UNIVERSAL_1_3))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ValidateModeGLComputeAndKernelBadSpv13, ValidateModeExecution, Combine(Values(SPV_ERROR_INVALID_DATA), Values("Execution mode can only be used with a Kernel or GLCompute " @@ -697,7 +697,7 @@ INSTANTIATE_TEST_CASE_P( Values("LocalSize 1 1 1", "LocalSizeId %int1 %int1 %int1"), Values(SPV_ENV_UNIVERSAL_1_3))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( ValidateModeAllGoodSpv13, ValidateModeExecution, Combine(Values(SPV_SUCCESS), Values(""), Values("Kernel", "GLCompute", "Geometry", "TessellationControl", diff --git a/3rdparty/spirv-tools/test/val/val_non_uniform_test.cpp b/3rdparty/spirv-tools/test/val/val_non_uniform_test.cpp index a185d8782..fbd11a9ef 100644 --- a/3rdparty/spirv-tools/test/val/val_non_uniform_test.cpp +++ b/3rdparty/spirv-tools/test/val/val_non_uniform_test.cpp @@ -182,63 +182,63 @@ TEST_P(GroupNonUniform, Spirv1p3) { } } -INSTANTIATE_TEST_CASE_P(GroupNonUniformElect, GroupNonUniform, - Combine(Values("OpGroupNonUniformElect"), - Values("%bool"), ValuesIn(scopes), Values(""), - Values(""))); +INSTANTIATE_TEST_SUITE_P(GroupNonUniformElect, GroupNonUniform, + Combine(Values("OpGroupNonUniformElect"), + Values("%bool"), ValuesIn(scopes), Values(""), + Values(""))); -INSTANTIATE_TEST_CASE_P(GroupNonUniformVote, GroupNonUniform, - Combine(Values("OpGroupNonUniformAll", - "OpGroupNonUniformAny", - "OpGroupNonUniformAllEqual"), - Values("%bool"), ValuesIn(scopes), - Values("%true"), Values(""))); +INSTANTIATE_TEST_SUITE_P(GroupNonUniformVote, GroupNonUniform, + Combine(Values("OpGroupNonUniformAll", + "OpGroupNonUniformAny", + "OpGroupNonUniformAllEqual"), + Values("%bool"), ValuesIn(scopes), + Values("%true"), Values(""))); -INSTANTIATE_TEST_CASE_P(GroupNonUniformBroadcast, GroupNonUniform, - Combine(Values("OpGroupNonUniformBroadcast"), - Values("%bool"), ValuesIn(scopes), - Values("%true %u32_0"), Values(""))); +INSTANTIATE_TEST_SUITE_P(GroupNonUniformBroadcast, GroupNonUniform, + Combine(Values("OpGroupNonUniformBroadcast"), + Values("%bool"), ValuesIn(scopes), + Values("%true %u32_0"), Values(""))); -INSTANTIATE_TEST_CASE_P(GroupNonUniformBroadcastFirst, GroupNonUniform, - Combine(Values("OpGroupNonUniformBroadcastFirst"), - Values("%bool"), ValuesIn(scopes), - Values("%true"), Values(""))); +INSTANTIATE_TEST_SUITE_P(GroupNonUniformBroadcastFirst, GroupNonUniform, + Combine(Values("OpGroupNonUniformBroadcastFirst"), + Values("%bool"), ValuesIn(scopes), + Values("%true"), Values(""))); -INSTANTIATE_TEST_CASE_P(GroupNonUniformBallot, GroupNonUniform, - Combine(Values("OpGroupNonUniformBallot"), - Values("%u32vec4"), ValuesIn(scopes), - Values("%true"), Values(""))); +INSTANTIATE_TEST_SUITE_P(GroupNonUniformBallot, GroupNonUniform, + Combine(Values("OpGroupNonUniformBallot"), + Values("%u32vec4"), ValuesIn(scopes), + Values("%true"), Values(""))); -INSTANTIATE_TEST_CASE_P(GroupNonUniformInverseBallot, GroupNonUniform, - Combine(Values("OpGroupNonUniformInverseBallot"), - Values("%bool"), ValuesIn(scopes), - Values("%u32vec4_null"), Values(""))); +INSTANTIATE_TEST_SUITE_P(GroupNonUniformInverseBallot, GroupNonUniform, + Combine(Values("OpGroupNonUniformInverseBallot"), + Values("%bool"), ValuesIn(scopes), + Values("%u32vec4_null"), Values(""))); -INSTANTIATE_TEST_CASE_P(GroupNonUniformBallotBitExtract, GroupNonUniform, - Combine(Values("OpGroupNonUniformBallotBitExtract"), - Values("%bool"), ValuesIn(scopes), - Values("%u32vec4_null %u32_0"), Values(""))); +INSTANTIATE_TEST_SUITE_P(GroupNonUniformBallotBitExtract, GroupNonUniform, + Combine(Values("OpGroupNonUniformBallotBitExtract"), + Values("%bool"), ValuesIn(scopes), + Values("%u32vec4_null %u32_0"), Values(""))); -INSTANTIATE_TEST_CASE_P(GroupNonUniformBallotBitCount, GroupNonUniform, - Combine(Values("OpGroupNonUniformBallotBitCount"), - Values("%u32"), ValuesIn(scopes), - Values("Reduce %u32vec4_null"), Values(""))); +INSTANTIATE_TEST_SUITE_P(GroupNonUniformBallotBitCount, GroupNonUniform, + Combine(Values("OpGroupNonUniformBallotBitCount"), + Values("%u32"), ValuesIn(scopes), + Values("Reduce %u32vec4_null"), Values(""))); -INSTANTIATE_TEST_CASE_P(GroupNonUniformBallotFind, GroupNonUniform, - Combine(Values("OpGroupNonUniformBallotFindLSB", - "OpGroupNonUniformBallotFindMSB"), - Values("%u32"), ValuesIn(scopes), - Values("%u32vec4_null"), Values(""))); +INSTANTIATE_TEST_SUITE_P(GroupNonUniformBallotFind, GroupNonUniform, + Combine(Values("OpGroupNonUniformBallotFindLSB", + "OpGroupNonUniformBallotFindMSB"), + Values("%u32"), ValuesIn(scopes), + Values("%u32vec4_null"), Values(""))); -INSTANTIATE_TEST_CASE_P(GroupNonUniformShuffle, GroupNonUniform, - Combine(Values("OpGroupNonUniformShuffle", - "OpGroupNonUniformShuffleXor", - "OpGroupNonUniformShuffleUp", - "OpGroupNonUniformShuffleDown"), - Values("%u32"), ValuesIn(scopes), - Values("%u32_0 %u32_0"), Values(""))); +INSTANTIATE_TEST_SUITE_P(GroupNonUniformShuffle, GroupNonUniform, + Combine(Values("OpGroupNonUniformShuffle", + "OpGroupNonUniformShuffleXor", + "OpGroupNonUniformShuffleUp", + "OpGroupNonUniformShuffleDown"), + Values("%u32"), ValuesIn(scopes), + Values("%u32_0 %u32_0"), Values(""))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( GroupNonUniformIntegerArithmetic, GroupNonUniform, Combine(Values("OpGroupNonUniformIAdd", "OpGroupNonUniformIMul", "OpGroupNonUniformSMin", "OpGroupNonUniformUMin", @@ -248,45 +248,45 @@ INSTANTIATE_TEST_CASE_P( Values("%u32"), ValuesIn(scopes), Values("Reduce %u32_0"), Values(""))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( GroupNonUniformFloatArithmetic, GroupNonUniform, Combine(Values("OpGroupNonUniformFAdd", "OpGroupNonUniformFMul", "OpGroupNonUniformFMin", "OpGroupNonUniformFMax"), Values("%float"), ValuesIn(scopes), Values("Reduce %float_0"), Values(""))); -INSTANTIATE_TEST_CASE_P(GroupNonUniformLogicalArithmetic, GroupNonUniform, - Combine(Values("OpGroupNonUniformLogicalAnd", - "OpGroupNonUniformLogicalOr", - "OpGroupNonUniformLogicalXor"), - Values("%bool"), ValuesIn(scopes), - Values("Reduce %true"), Values(""))); +INSTANTIATE_TEST_SUITE_P(GroupNonUniformLogicalArithmetic, GroupNonUniform, + Combine(Values("OpGroupNonUniformLogicalAnd", + "OpGroupNonUniformLogicalOr", + "OpGroupNonUniformLogicalXor"), + Values("%bool"), ValuesIn(scopes), + Values("Reduce %true"), Values(""))); -INSTANTIATE_TEST_CASE_P(GroupNonUniformQuad, GroupNonUniform, - Combine(Values("OpGroupNonUniformQuadBroadcast", - "OpGroupNonUniformQuadSwap"), - Values("%u32"), ValuesIn(scopes), - Values("%u32_0 %u32_0"), Values(""))); +INSTANTIATE_TEST_SUITE_P(GroupNonUniformQuad, GroupNonUniform, + Combine(Values("OpGroupNonUniformQuadBroadcast", + "OpGroupNonUniformQuadSwap"), + Values("%u32"), ValuesIn(scopes), + Values("%u32_0 %u32_0"), Values(""))); -INSTANTIATE_TEST_CASE_P(GroupNonUniformBallotBitCountScope, GroupNonUniform, - Combine(Values("OpGroupNonUniformBallotBitCount"), - Values("%u32"), ValuesIn(scopes), - Values("Reduce %u32vec4_null"), Values(""))); +INSTANTIATE_TEST_SUITE_P(GroupNonUniformBallotBitCountScope, GroupNonUniform, + Combine(Values("OpGroupNonUniformBallotBitCount"), + Values("%u32"), ValuesIn(scopes), + Values("Reduce %u32vec4_null"), Values(""))); -INSTANTIATE_TEST_CASE_P( +INSTANTIATE_TEST_SUITE_P( GroupNonUniformBallotBitCountBadResultType, GroupNonUniform, Combine( Values("OpGroupNonUniformBallotBitCount"), Values("%float", "%int"), Values(SpvScopeSubgroup), Values("Reduce %u32vec4_null"), Values("Expected Result Type to be an unsigned integer type scalar."))); -INSTANTIATE_TEST_CASE_P(GroupNonUniformBallotBitCountBadValue, GroupNonUniform, - Combine(Values("OpGroupNonUniformBallotBitCount"), - Values("%u32"), Values(SpvScopeSubgroup), - Values("Reduce %u32vec3_null", "Reduce %u32_0", - "Reduce %float_0"), - Values("Expected Value to be a vector of four " - "components of integer type scalar"))); +INSTANTIATE_TEST_SUITE_P(GroupNonUniformBallotBitCountBadValue, GroupNonUniform, + Combine(Values("OpGroupNonUniformBallotBitCount"), + Values("%u32"), Values(SpvScopeSubgroup), + Values("Reduce %u32vec3_null", "Reduce %u32_0", + "Reduce %float_0"), + Values("Expected Value to be a vector of four " + "components of integer type scalar"))); } // namespace } // namespace val diff --git a/3rdparty/spirv-tools/test/val/val_ssa_test.cpp b/3rdparty/spirv-tools/test/val/val_ssa_test.cpp index 5d8fa4b7e..e10abd7ab 100644 --- a/3rdparty/spirv-tools/test/val/val_ssa_test.cpp +++ b/3rdparty/spirv-tools/test/val/val_ssa_test.cpp @@ -823,7 +823,7 @@ std::pair cases[] = { {"OpGetKernelWorkGroupSize", kNoNDrange}, {"OpGetKernelPreferredWorkGroupSizeMultiple", kNoNDrange}}; -INSTANTIATE_TEST_CASE_P(KernelArgs, ValidateSSA, ::testing::ValuesIn(cases), ); +INSTANTIATE_TEST_SUITE_P(KernelArgs, ValidateSSA, ::testing::ValuesIn(cases)); static const std::string return_instructions = R"( OpReturn diff --git a/3rdparty/spirv-tools/test/val/val_storage_test.cpp b/3rdparty/spirv-tools/test/val/val_storage_test.cpp index aa1eecda8..6f4fe4224 100644 --- a/3rdparty/spirv-tools/test/val/val_storage_test.cpp +++ b/3rdparty/spirv-tools/test/val/val_storage_test.cpp @@ -137,7 +137,7 @@ TEST_P(ValidateStorage, OtherStorageInsideFunction) { "Variables must have a function[7] storage class inside of a function")); } -INSTANTIATE_TEST_CASE_P(MatrixOp, ValidateStorage, +INSTANTIATE_TEST_SUITE_P(MatrixOp, ValidateStorage, ::testing::Values( "Input", "Uniform", @@ -147,7 +147,7 @@ INSTANTIATE_TEST_CASE_P(MatrixOp, ValidateStorage, "Private", "PushConstant", "AtomicCounter", - "Image"),); + "Image")); // clang-format on TEST_F(ValidateStorage, GenericVariableOutsideFunction) { diff --git a/3rdparty/spirv-tools/test/val/val_version_test.cpp b/3rdparty/spirv-tools/test/val/val_version_test.cpp index eb9bbb960..0b194b936 100644 --- a/3rdparty/spirv-tools/test/val/val_version_test.cpp +++ b/3rdparty/spirv-tools/test/val/val_version_test.cpp @@ -108,7 +108,7 @@ TEST_P(ValidateVersion, version) { } // clang-format off -INSTANTIATE_TEST_CASE_P(Universal, ValidateVersion, +INSTANTIATE_TEST_SUITE_P(Universal, ValidateVersion, ::testing::Values( // Binary version, Target environment std::make_tuple(SPV_ENV_UNIVERSAL_1_0, SPV_ENV_UNIVERSAL_1_0, vulkan_spirv, true), @@ -165,7 +165,7 @@ INSTANTIATE_TEST_CASE_P(Universal, ValidateVersion, ) ); -INSTANTIATE_TEST_CASE_P(Vulkan, ValidateVersion, +INSTANTIATE_TEST_SUITE_P(Vulkan, ValidateVersion, ::testing::Values( // Binary version, Target environment std::make_tuple(SPV_ENV_VULKAN_1_0, SPV_ENV_UNIVERSAL_1_0, vulkan_spirv, true), @@ -194,7 +194,7 @@ INSTANTIATE_TEST_CASE_P(Vulkan, ValidateVersion, ) ); -INSTANTIATE_TEST_CASE_P(OpenCL, ValidateVersion, +INSTANTIATE_TEST_SUITE_P(OpenCL, ValidateVersion, ::testing::Values( // Binary version, Target environment std::make_tuple(SPV_ENV_OPENCL_2_0, SPV_ENV_UNIVERSAL_1_0, opencl_spirv, true), @@ -247,7 +247,7 @@ INSTANTIATE_TEST_CASE_P(OpenCL, ValidateVersion, ) ); -INSTANTIATE_TEST_CASE_P(OpenCLEmbedded, ValidateVersion, +INSTANTIATE_TEST_SUITE_P(OpenCLEmbedded, ValidateVersion, ::testing::Values( // Binary version, Target environment std::make_tuple(SPV_ENV_OPENCL_EMBEDDED_2_0, SPV_ENV_UNIVERSAL_1_0, opencl_spirv, true), diff --git a/3rdparty/spirv-tools/tools/reduce/reduce.cpp b/3rdparty/spirv-tools/tools/reduce/reduce.cpp index 4d497688c..e119e1ef9 100644 --- a/3rdparty/spirv-tools/tools/reduce/reduce.cpp +++ b/3rdparty/spirv-tools/tools/reduce/reduce.cpp @@ -20,6 +20,7 @@ #include "source/opt/build_module.h" #include "source/opt/ir_context.h" #include "source/opt/log.h" +#include "source/reduce/merge_blocks_reduction_opportunity_finder.h" #include "source/reduce/operand_to_const_reduction_opportunity_finder.h" #include "source/reduce/operand_to_dominating_id_reduction_opportunity_finder.h" #include "source/reduce/operand_to_undef_reduction_opportunity_finder.h" @@ -240,6 +241,8 @@ int main(int argc, const char** argv) { reducer.AddReductionPass( spvtools::MakeUnique< StructuredLoopToSelectionReductionOpportunityFinder>()); + reducer.AddReductionPass( + spvtools::MakeUnique()); reducer.SetMessageConsumer(spvtools::utils::CLIMessageConsumer);