mirror of
https://gitee.com/openharmony/third_party_spirv-tools
synced 2024-11-27 01:21:25 +00:00
Assembler tests for OpCapability.
Adds test file for instructions in the Mode-Setting section of the SPIR-V spec.
This commit is contained in:
parent
55bdfcb0bc
commit
c6402d64f4
@ -188,6 +188,7 @@ if (NOT ${SPIRV_SKIP_EXECUTABLES})
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/TextToBinary.Annotation.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/TextToBinary.Debug.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/TextToBinary.Miscellaneous.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/TextToBinary.ModeSetting.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/TextWordGet.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/UnitSPIRV.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/Validate.cpp
|
||||
|
@ -33,6 +33,8 @@ The validator is incomplete. See the Future Work section for more information.
|
||||
SubgroupId
|
||||
* All handling of FPFastMathMode masks.
|
||||
* LinkageAttributes now requires the literal string operand.
|
||||
* Fixes capabilities: Adds ImageMipmap, and capabilities from LiteralSampler through
|
||||
SampleRateShading.
|
||||
|
||||
2015-09-09
|
||||
* Avoid confusion about ownership of storage:
|
||||
|
@ -1257,6 +1257,11 @@ static const spv_operand_desc_t capabilityInfoEntries[] = {
|
||||
SPV_OPCODE_FLAGS_NONE,
|
||||
0,
|
||||
{SPV_OPERAND_TYPE_NONE}},
|
||||
{"ImageMipmap",
|
||||
CapabilityImageMipmap,
|
||||
SPV_OPCODE_FLAGS_NONE,
|
||||
0,
|
||||
{SPV_OPERAND_TYPE_NONE}},
|
||||
{"ImageSRGBWrite",
|
||||
CapabilityImageSRGBWrite,
|
||||
SPV_OPCODE_FLAGS_NONE,
|
||||
@ -1277,86 +1282,25 @@ static const spv_operand_desc_t capabilityInfoEntries[] = {
|
||||
SPV_OPCODE_FLAGS_NONE,
|
||||
0,
|
||||
{SPV_OPERAND_TYPE_NONE}},
|
||||
{"LiteralSampler",
|
||||
CapabilityLiteralSampler,
|
||||
SPV_OPCODE_FLAGS_NONE,
|
||||
0,
|
||||
{SPV_OPERAND_TYPE_NONE}},
|
||||
{"AtomicStorage",
|
||||
CapabilityAtomicStorage,
|
||||
SPV_OPCODE_FLAGS_NONE,
|
||||
0,
|
||||
{SPV_OPERAND_TYPE_NONE}},
|
||||
{"Int16",
|
||||
CapabilityInt16,
|
||||
SPV_OPCODE_FLAGS_NONE,
|
||||
0,
|
||||
{SPV_OPERAND_TYPE_NONE}},
|
||||
{"TessellationPointSize",
|
||||
CapabilityTessellationPointSize,
|
||||
SPV_OPCODE_FLAGS_CAPABILITIES,
|
||||
CapabilityTessellation,
|
||||
{SPV_OPERAND_TYPE_NONE}},
|
||||
{"GeometryPointSize",
|
||||
CapabilityGeometryPointSize,
|
||||
SPV_OPCODE_FLAGS_CAPABILITIES,
|
||||
CapabilityGeometry,
|
||||
{SPV_OPERAND_TYPE_NONE}},
|
||||
{"ImageGatherExtended",
|
||||
CapabilityImageGatherExtended,
|
||||
SPV_OPCODE_FLAGS_NONE,
|
||||
0,
|
||||
{SPV_OPERAND_TYPE_NONE}},
|
||||
{"StorageImageExtendedFormats",
|
||||
CapabilityStorageImageExtendedFormats,
|
||||
SPV_OPCODE_FLAGS_NONE,
|
||||
0,
|
||||
{SPV_OPERAND_TYPE_NONE}},
|
||||
{"StorageImageMultisample",
|
||||
CapabilityStorageImageMultisample,
|
||||
SPV_OPCODE_FLAGS_NONE,
|
||||
0,
|
||||
{SPV_OPERAND_TYPE_NONE}},
|
||||
{"UniformBufferArrayDynamicIndexing",
|
||||
CapabilityUniformBufferArrayDynamicIndexing,
|
||||
SPV_OPCODE_FLAGS_NONE,
|
||||
0,
|
||||
{SPV_OPERAND_TYPE_NONE}},
|
||||
{"SampledImageArrayDynamicIndexing",
|
||||
CapabilitySampledImageArrayDynamicIndexing,
|
||||
SPV_OPCODE_FLAGS_NONE,
|
||||
0,
|
||||
{SPV_OPERAND_TYPE_NONE}},
|
||||
{"StorageBufferArrayDynamicIndexing",
|
||||
CapabilityStorageBufferArrayDynamicIndexing,
|
||||
SPV_OPCODE_FLAGS_NONE,
|
||||
0,
|
||||
{SPV_OPERAND_TYPE_NONE}},
|
||||
{"StorageImageArrayDynamicIndexing",
|
||||
CapabilityStorageImageArrayDynamicIndexing,
|
||||
SPV_OPCODE_FLAGS_NONE,
|
||||
0,
|
||||
{SPV_OPERAND_TYPE_NONE}},
|
||||
{"ClipDistance",
|
||||
CapabilityClipDistance,
|
||||
SPV_OPCODE_FLAGS_CAPABILITIES,
|
||||
CapabilityShader,
|
||||
{SPV_OPERAND_TYPE_NONE}},
|
||||
{"CullDistance",
|
||||
CapabilityCullDistance,
|
||||
SPV_OPCODE_FLAGS_CAPABILITIES,
|
||||
CapabilityShader,
|
||||
{SPV_OPERAND_TYPE_NONE}},
|
||||
{"ImageCubeArray",
|
||||
CapabilityImageCubeArray,
|
||||
SPV_OPCODE_FLAGS_NONE,
|
||||
0,
|
||||
{SPV_OPERAND_TYPE_NONE}},
|
||||
{"SampleRateShading",
|
||||
CapabilitySampleRateShading,
|
||||
SPV_OPCODE_FLAGS_CAPABILITIES,
|
||||
CapabilityShader,
|
||||
{SPV_OPERAND_TYPE_NONE}},
|
||||
// A macro for defining a capability that doesn't depend on other capabilities.
|
||||
#define CASE(NAME) { #NAME, Capability##NAME, SPV_OPCODE_FLAGS_NONE, 0, {SPV_OPERAND_TYPE_NONE}}
|
||||
CASE(LiteralSampler),
|
||||
CASE(AtomicStorage),
|
||||
CASE(Int16),
|
||||
CASE(TessellationPointSize),
|
||||
CASE(GeometryPointSize),
|
||||
CASE(ImageGatherExtended),
|
||||
CASE(StorageImageExtendedFormats),
|
||||
CASE(StorageImageMultisample),
|
||||
CASE(UniformBufferArrayDynamicIndexing),
|
||||
CASE(SampledImageArrayDynamicIndexing),
|
||||
CASE(StorageBufferArrayDynamicIndexing),
|
||||
CASE(StorageImageArrayDynamicIndexing),
|
||||
CASE(ClipDistance),
|
||||
CASE(CullDistance),
|
||||
CASE(ImageCubeArray),
|
||||
CASE(SampleRateShading),
|
||||
#undef CASE
|
||||
};
|
||||
|
||||
static const spv_operand_desc_group_t opcodeEntryTypes[] = {
|
||||
|
104
test/TextToBinary.ModeSetting.cpp
Normal file
104
test/TextToBinary.ModeSetting.cpp
Normal file
@ -0,0 +1,104 @@
|
||||
// Copyright (c) 2015 The Khronos Group Inc.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and/or associated documentation files (the
|
||||
// "Materials"), to deal in the Materials without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
// permit persons to whom the Materials are furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Materials.
|
||||
//
|
||||
// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
|
||||
// KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
|
||||
// SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
|
||||
// https://www.khronos.org/registry/
|
||||
//
|
||||
// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
// MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
|
||||
// Assembler tests for instructions in the "Mode-Setting" section of the
|
||||
// SPIR-V spec.
|
||||
|
||||
#include "UnitSPIRV.h"
|
||||
|
||||
#include "gmock/gmock.h"
|
||||
#include "TestFixture.h"
|
||||
|
||||
namespace {
|
||||
|
||||
using spvtest::MakeInstruction;
|
||||
using ::testing::Eq;
|
||||
|
||||
// Test OpCapability
|
||||
|
||||
struct CapabilityCase {
|
||||
spv::Capability value;
|
||||
std::string name;
|
||||
};
|
||||
|
||||
using OpCapabilityTest = test_fixture::TextToBinaryTestBase<
|
||||
::testing::TestWithParam<CapabilityCase>>;
|
||||
|
||||
TEST_P(OpCapabilityTest, AnyCapability) {
|
||||
std::string input = "OpCapability " + GetParam().name;
|
||||
EXPECT_THAT(CompiledInstructions(input),
|
||||
Eq(MakeInstruction(spv::OpCapability, {GetParam().value})));
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
#define CASE(NAME) { spv::Capability##NAME, #NAME }
|
||||
INSTANTIATE_TEST_CASE_P(TextToBinaryCapability, OpCapabilityTest,
|
||||
::testing::ValuesIn(std::vector<CapabilityCase>{
|
||||
CASE(Matrix),
|
||||
CASE(Shader),
|
||||
CASE(Geometry),
|
||||
CASE(Tessellation),
|
||||
CASE(Addresses),
|
||||
CASE(Linkage),
|
||||
CASE(Kernel),
|
||||
CASE(Vector16),
|
||||
CASE(Float16Buffer),
|
||||
CASE(Float16),
|
||||
CASE(Float64),
|
||||
CASE(Int64),
|
||||
CASE(Int64Atomics),
|
||||
CASE(ImageBasic),
|
||||
CASE(ImageReadWrite),
|
||||
CASE(ImageMipmap),
|
||||
CASE(ImageSRGBWrite),
|
||||
CASE(Pipes),
|
||||
CASE(Groups),
|
||||
CASE(DeviceEnqueue),
|
||||
CASE(LiteralSampler),
|
||||
CASE(AtomicStorage),
|
||||
CASE(Int16),
|
||||
CASE(TessellationPointSize),
|
||||
CASE(GeometryPointSize),
|
||||
CASE(ImageGatherExtended),
|
||||
CASE(StorageImageExtendedFormats),
|
||||
CASE(StorageImageMultisample),
|
||||
CASE(UniformBufferArrayDynamicIndexing),
|
||||
CASE(SampledImageArrayDynamicIndexing),
|
||||
CASE(StorageBufferArrayDynamicIndexing),
|
||||
CASE(StorageImageArrayDynamicIndexing),
|
||||
CASE(ClipDistance),
|
||||
CASE(CullDistance),
|
||||
CASE(ImageCubeArray),
|
||||
CASE(SampleRateShading),
|
||||
}));
|
||||
#undef CASE
|
||||
// clang-format on
|
||||
|
||||
// TODO(dneto): OpMemoryModel
|
||||
// TODO(dneto): OpMemoryEntryPoint
|
||||
// TODO(dneto): OpExecutionMode
|
||||
|
||||
} // anonymous namespace
|
Loading…
Reference in New Issue
Block a user