|
@@ -316,22 +316,6 @@ TEST_F(SpirvContextTest, SampledImageTypeUnique2) {
|
|
|
spvContext.getSampledImageType(img2));
|
|
|
}
|
|
|
|
|
|
-TEST_F(SpirvContextTest, HybridSampledImageTypeUnique1) {
|
|
|
- const clang::ASTContext &astContext = getAstContext();
|
|
|
- SpirvContext &spvContext = getSpirvContext();
|
|
|
- clang::QualType int32 = astContext.IntTy;
|
|
|
-
|
|
|
- EXPECT_EQ(spvContext.getSampledImageType(int32),
|
|
|
- spvContext.getSampledImageType(int32));
|
|
|
-}
|
|
|
-
|
|
|
-TEST_F(SpirvContextTest, HybridSampledImageTypeUnique2) {
|
|
|
- const clang::ASTContext &astContext = getAstContext();
|
|
|
- SpirvContext &spvContext = getSpirvContext();
|
|
|
- EXPECT_NE(spvContext.getSampledImageType(astContext.IntTy),
|
|
|
- spvContext.getSampledImageType(astContext.UnsignedIntTy));
|
|
|
-}
|
|
|
-
|
|
|
TEST_F(SpirvContextTest, ArrayTypeUnique1) {
|
|
|
SpirvContext &spvContext = getSpirvContext();
|
|
|
const auto *int32 = spvContext.getSIntType(32);
|
|
@@ -415,31 +399,6 @@ TEST_F(SpirvContextTest, PointerTypeUnique3) {
|
|
|
spvContext.getPointerType(int32, spv::StorageClass::Uniform));
|
|
|
}
|
|
|
|
|
|
-TEST_F(SpirvContextTest, HybridPointerTypeUnique1) {
|
|
|
- auto &astContext = getAstContext();
|
|
|
- auto &spvContext = getSpirvContext();
|
|
|
- EXPECT_EQ(
|
|
|
- spvContext.getPointerType(astContext.IntTy, spv::StorageClass::Function),
|
|
|
- spvContext.getPointerType(astContext.IntTy, spv::StorageClass::Function));
|
|
|
-}
|
|
|
-
|
|
|
-TEST_F(SpirvContextTest, HybridPointerTypeUnique2) {
|
|
|
- auto &astContext = getAstContext();
|
|
|
- auto &spvContext = getSpirvContext();
|
|
|
- EXPECT_NE(
|
|
|
- spvContext.getPointerType(astContext.IntTy, spv::StorageClass::Function),
|
|
|
- spvContext.getPointerType(astContext.FloatTy,
|
|
|
- spv::StorageClass::Function));
|
|
|
-}
|
|
|
-
|
|
|
-TEST_F(SpirvContextTest, HybridPointerTypeUnique3) {
|
|
|
- auto &astContext = getAstContext();
|
|
|
- auto &spvContext = getSpirvContext();
|
|
|
- EXPECT_NE(
|
|
|
- spvContext.getPointerType(astContext.IntTy, spv::StorageClass::Function),
|
|
|
- spvContext.getPointerType(astContext.IntTy, spv::StorageClass::Uniform));
|
|
|
-}
|
|
|
-
|
|
|
TEST_F(SpirvContextTest, FunctionTypeUnique1) {
|
|
|
auto &spvContext = getSpirvContext();
|
|
|
const auto *int32 = spvContext.getSIntType(32);
|
|
@@ -483,57 +442,6 @@ TEST_F(SpirvContextTest, FunctionTypeUnique4) {
|
|
|
EXPECT_NE(fnType1, fnType2);
|
|
|
}
|
|
|
|
|
|
-TEST_F(SpirvContextTest, HybridFunctionTypeUnique1) {
|
|
|
- auto &spvContext = getSpirvContext();
|
|
|
- auto &astContext = getAstContext();
|
|
|
- const auto *uint32 = spvContext.getUIntType(32);
|
|
|
- const auto *float32 = spvContext.getFloatType(32);
|
|
|
- auto *fnType1 =
|
|
|
- spvContext.getFunctionType(astContext.IntTy, {uint32, float32});
|
|
|
- auto *fnType2 =
|
|
|
- spvContext.getFunctionType(astContext.IntTy, {uint32, float32});
|
|
|
- EXPECT_EQ(fnType1, fnType2);
|
|
|
-}
|
|
|
-
|
|
|
-TEST_F(SpirvContextTest, HybridFunctionTypeUnique2) {
|
|
|
- // The number of params is different.
|
|
|
- auto &spvContext = getSpirvContext();
|
|
|
- auto &astContext = getAstContext();
|
|
|
- const auto *uint32 = spvContext.getUIntType(32);
|
|
|
- const auto *float32 = spvContext.getFloatType(32);
|
|
|
- auto *fnType1 =
|
|
|
- spvContext.getFunctionType(astContext.IntTy, {uint32, float32});
|
|
|
- auto *fnType2 = spvContext.getFunctionType(astContext.IntTy, {uint32});
|
|
|
- EXPECT_NE(fnType1, fnType2);
|
|
|
-}
|
|
|
-
|
|
|
-TEST_F(SpirvContextTest, HybridFunctionTypeUnique3) {
|
|
|
- // Return type is different.
|
|
|
- auto &spvContext = getSpirvContext();
|
|
|
- auto &astContext = getAstContext();
|
|
|
- const auto *uint32 = spvContext.getUIntType(32);
|
|
|
- const auto *float32 = spvContext.getFloatType(32);
|
|
|
- auto *fnType1 =
|
|
|
- spvContext.getFunctionType(astContext.IntTy, {uint32, float32});
|
|
|
- auto *fnType2 =
|
|
|
- spvContext.getFunctionType(astContext.UnsignedIntTy, {uint32, float32});
|
|
|
- EXPECT_NE(fnType1, fnType2);
|
|
|
-}
|
|
|
-
|
|
|
-TEST_F(SpirvContextTest, HybridFunctionTypeUnique4) {
|
|
|
- // Parameter kinds are different.
|
|
|
- auto &spvContext = getSpirvContext();
|
|
|
- auto &astContext = getAstContext();
|
|
|
- const auto *int32 = spvContext.getSIntType(32);
|
|
|
- const auto *uint32 = spvContext.getUIntType(32);
|
|
|
- const auto *float32 = spvContext.getFloatType(32);
|
|
|
- const auto *fnType1 =
|
|
|
- spvContext.getFunctionType(astContext.IntTy, {uint32, float32});
|
|
|
- const auto *fnType2 =
|
|
|
- spvContext.getFunctionType(astContext.IntTy, {int32, float32});
|
|
|
- EXPECT_NE(fnType1, fnType2);
|
|
|
-}
|
|
|
-
|
|
|
TEST_F(SpirvContextTest, ByteAddressBufferTypeUnique1) {
|
|
|
auto &spvContext = getSpirvContext();
|
|
|
const auto *type1 = spvContext.getByteAddressBufferType(false);
|
|
@@ -729,173 +637,4 @@ TEST_F(SpirvContextTest, StructTypeUnique9) {
|
|
|
EXPECT_NE(type1, type2);
|
|
|
}
|
|
|
|
|
|
-TEST_F(SpirvContextTest, HybridStructTypeUnique1) {
|
|
|
- auto &astContext = getAstContext();
|
|
|
- auto &spvContext = getSpirvContext();
|
|
|
- const auto int32 = astContext.IntTy;
|
|
|
- const auto uint32 = astContext.UnsignedIntTy;
|
|
|
-
|
|
|
- const auto *type1 = spvContext.getHybridStructType(
|
|
|
- {HybridStructType::FieldInfo(int32, "field1"),
|
|
|
- HybridStructType::FieldInfo(uint32, "field2")},
|
|
|
- "struct1", /*isReadOnly*/ false, StructInterfaceType::InternalStorage);
|
|
|
-
|
|
|
- const auto *type2 = spvContext.getHybridStructType(
|
|
|
- {HybridStructType::FieldInfo(int32, "field1"),
|
|
|
- HybridStructType::FieldInfo(uint32, "field2")},
|
|
|
- "struct1", /*isReadOnly*/ false, StructInterfaceType::InternalStorage);
|
|
|
-
|
|
|
- EXPECT_EQ(type1, type2);
|
|
|
-}
|
|
|
-
|
|
|
-TEST_F(SpirvContextTest, HybridStructTypeUnique2) {
|
|
|
- // Struct names are different
|
|
|
- auto &astContext = getAstContext();
|
|
|
- auto &spvContext = getSpirvContext();
|
|
|
- const auto int32 = astContext.IntTy;
|
|
|
- const auto uint32 = astContext.UnsignedIntTy;
|
|
|
-
|
|
|
- const auto *type1 = spvContext.getHybridStructType(
|
|
|
- {HybridStructType::FieldInfo(int32, "field1"),
|
|
|
- HybridStructType::FieldInfo(uint32, "field2")},
|
|
|
- "struct1", /*isReadOnly*/ false, StructInterfaceType::InternalStorage);
|
|
|
-
|
|
|
- const auto *type2 = spvContext.getHybridStructType(
|
|
|
- {HybridStructType::FieldInfo(int32, "field1"),
|
|
|
- HybridStructType::FieldInfo(uint32, "field2")},
|
|
|
- "struct2", /*isReadOnly*/ false, StructInterfaceType::InternalStorage);
|
|
|
-
|
|
|
- EXPECT_NE(type1, type2);
|
|
|
-}
|
|
|
-
|
|
|
-TEST_F(SpirvContextTest, HybridStructTypeUnique3) {
|
|
|
- // Read-only-ness is different
|
|
|
- auto &astContext = getAstContext();
|
|
|
- auto &spvContext = getSpirvContext();
|
|
|
- const auto int32 = astContext.IntTy;
|
|
|
- const auto uint32 = astContext.UnsignedIntTy;
|
|
|
-
|
|
|
- const auto *type1 = spvContext.getHybridStructType(
|
|
|
- {HybridStructType::FieldInfo(int32, "field1"),
|
|
|
- HybridStructType::FieldInfo(uint32, "field2")},
|
|
|
- "struct1", /*isReadOnly*/ false, StructInterfaceType::InternalStorage);
|
|
|
-
|
|
|
- const auto *type2 = spvContext.getHybridStructType(
|
|
|
- {HybridStructType::FieldInfo(int32, "field1"),
|
|
|
- HybridStructType::FieldInfo(uint32, "field2")},
|
|
|
- "struct1", /*isReadOnly*/ true, StructInterfaceType::InternalStorage);
|
|
|
-
|
|
|
- EXPECT_NE(type1, type2);
|
|
|
-}
|
|
|
-
|
|
|
-TEST_F(SpirvContextTest, HybridStructTypeUnique4) {
|
|
|
- // Interface type is different
|
|
|
- auto &astContext = getAstContext();
|
|
|
- auto &spvContext = getSpirvContext();
|
|
|
- const auto int32 = astContext.IntTy;
|
|
|
- const auto uint32 = astContext.UnsignedIntTy;
|
|
|
-
|
|
|
- const auto *type1 = spvContext.getHybridStructType(
|
|
|
- {HybridStructType::FieldInfo(int32, "field1"),
|
|
|
- HybridStructType::FieldInfo(uint32, "field2")},
|
|
|
- "struct1", /*isReadOnly*/ false, StructInterfaceType::InternalStorage);
|
|
|
-
|
|
|
- const auto *type2 = spvContext.getHybridStructType(
|
|
|
- {HybridStructType::FieldInfo(int32, "field1"),
|
|
|
- HybridStructType::FieldInfo(uint32, "field2")},
|
|
|
- "struct1", /*isReadOnly*/ false, StructInterfaceType::StorageBuffer);
|
|
|
-
|
|
|
- EXPECT_NE(type1, type2);
|
|
|
-}
|
|
|
-
|
|
|
-TEST_F(SpirvContextTest, HybridStructTypeUnique5) {
|
|
|
- // Fields have different types
|
|
|
- auto &astContext = getAstContext();
|
|
|
- auto &spvContext = getSpirvContext();
|
|
|
- const auto int32 = astContext.IntTy;
|
|
|
- const auto uint32 = astContext.UnsignedIntTy;
|
|
|
-
|
|
|
- const auto *type1 = spvContext.getHybridStructType(
|
|
|
- {HybridStructType::FieldInfo(int32, "field"),
|
|
|
- HybridStructType::FieldInfo(uint32, "field")},
|
|
|
- "struct1", /*isReadOnly*/ false, StructInterfaceType::InternalStorage);
|
|
|
-
|
|
|
- const auto *type2 = spvContext.getHybridStructType(
|
|
|
- {HybridStructType::FieldInfo(uint32, "field"),
|
|
|
- HybridStructType::FieldInfo(int32, "field")},
|
|
|
- "struct1", /*isReadOnly*/ false, StructInterfaceType::StorageBuffer);
|
|
|
-
|
|
|
- EXPECT_NE(type1, type2);
|
|
|
-}
|
|
|
-
|
|
|
-TEST_F(SpirvContextTest, HybridStructTypeUnique6) {
|
|
|
- // Fields have different names
|
|
|
- auto &astContext = getAstContext();
|
|
|
- auto &spvContext = getSpirvContext();
|
|
|
- const auto int32 = astContext.IntTy;
|
|
|
- const auto uint32 = astContext.UnsignedIntTy;
|
|
|
-
|
|
|
- const auto *type1 = spvContext.getHybridStructType(
|
|
|
- {HybridStructType::FieldInfo(int32, "sine"),
|
|
|
- HybridStructType::FieldInfo(uint32, "field2")},
|
|
|
- "struct1", /*isReadOnly*/ false, StructInterfaceType::InternalStorage);
|
|
|
-
|
|
|
- const auto *type2 = spvContext.getHybridStructType(
|
|
|
- {HybridStructType::FieldInfo(int32, "cosine"),
|
|
|
- HybridStructType::FieldInfo(uint32, "field2")},
|
|
|
- "struct1", /*isReadOnly*/ false, StructInterfaceType::StorageBuffer);
|
|
|
-
|
|
|
- EXPECT_NE(type1, type2);
|
|
|
-}
|
|
|
-
|
|
|
-TEST_F(SpirvContextTest, HybridStructTypeUnique7) {
|
|
|
- // Fields have different vk::offset.
|
|
|
- auto &astContext = getAstContext();
|
|
|
- auto &spvContext = getSpirvContext();
|
|
|
- const auto int32 = astContext.IntTy;
|
|
|
- const auto uint32 = astContext.UnsignedIntTy;
|
|
|
- auto *vkOffsetAttr1 = clang::VKOffsetAttr::CreateImplicit(astContext, 4, {});
|
|
|
- auto *vkOffsetAttr2 = clang::VKOffsetAttr::CreateImplicit(astContext, 8, {});
|
|
|
-
|
|
|
- const auto *type1 = spvContext.getHybridStructType(
|
|
|
- {HybridStructType::FieldInfo(int32, "field1", vkOffsetAttr1),
|
|
|
- HybridStructType::FieldInfo(uint32, "field2")},
|
|
|
- "struct1", /*isReadOnly*/ false, StructInterfaceType::InternalStorage);
|
|
|
-
|
|
|
- const auto *type2 = spvContext.getHybridStructType(
|
|
|
- {HybridStructType::FieldInfo(int32, "field1", vkOffsetAttr2),
|
|
|
- HybridStructType::FieldInfo(uint32, "field2")},
|
|
|
- "struct1", /*isReadOnly*/ false, StructInterfaceType::StorageBuffer);
|
|
|
-
|
|
|
- EXPECT_NE(type1, type2);
|
|
|
-}
|
|
|
-
|
|
|
-TEST_F(SpirvContextTest, HybridStructTypeUnique8) {
|
|
|
- // Fields have different :packoffset.
|
|
|
- auto &astContext = getAstContext();
|
|
|
- auto &spvContext = getSpirvContext();
|
|
|
- const auto int32 = astContext.IntTy;
|
|
|
- const auto uint32 = astContext.UnsignedIntTy;
|
|
|
- auto *vkOffsetAttr = clang::VKOffsetAttr::CreateImplicit(astContext, 4, {});
|
|
|
-
|
|
|
- hlsl::ConstantPacking packing1;
|
|
|
- packing1.ComponentOffset = 0;
|
|
|
- packing1.Subcomponent = 1;
|
|
|
- hlsl::ConstantPacking packing2;
|
|
|
- packing2.ComponentOffset = 1;
|
|
|
- packing2.Subcomponent = 2;
|
|
|
-
|
|
|
- const auto *type1 = spvContext.getHybridStructType(
|
|
|
- {HybridStructType::FieldInfo(int32, "field1", vkOffsetAttr),
|
|
|
- HybridStructType::FieldInfo(uint32, "field2", nullptr, &packing1)},
|
|
|
- "struct1", /*isReadOnly*/ false, StructInterfaceType::InternalStorage);
|
|
|
-
|
|
|
- const auto *type2 = spvContext.getHybridStructType(
|
|
|
- {HybridStructType::FieldInfo(int32, "field1", vkOffsetAttr),
|
|
|
- HybridStructType::FieldInfo(uint32, "field2", nullptr, &packing2)},
|
|
|
- "struct1", /*isReadOnly*/ false, StructInterfaceType::StorageBuffer);
|
|
|
-
|
|
|
- EXPECT_NE(type1, type2);
|
|
|
-}
|
|
|
-
|
|
|
} // anonymous namespace
|