@@ -1599,7 +1599,7 @@ TEST_F(ValidateInterfacesTest, InvalidLocationTypePointer) {
1599
1599
HasSubstr (" Invalid type to assign a location" ));
1600
1600
}
1601
1601
1602
- TEST_F (ValidateInterfacesTest, PhysicalStorageBufferPointer ) {
1602
+ TEST_F (ValidateInterfacesTest, ValidLocationTypePhysicalStorageBufferPointer ) {
1603
1603
const std::string text = R"(
1604
1604
OpCapability Shader
1605
1605
OpCapability PhysicalStorageBufferAddresses
@@ -1608,151 +1608,18 @@ OpEntryPoint Vertex %main "main" %var
1608
1608
OpDecorate %var Location 0
1609
1609
OpDecorate %var RestrictPointer
1610
1610
%void = OpTypeVoid
1611
- %uint = OpTypeInt 32 0
1612
- %psb_ptr = OpTypePointer PhysicalStorageBuffer %uint
1613
- %in_ptr = OpTypePointer Input %psb_ptr
1614
- %var = OpVariable %in_ptr Input
1615
- %void_fn = OpTypeFunction %void
1616
- %main = OpFunction %void None %void_fn
1617
- %entry = OpLabel
1618
- OpReturn
1619
- OpFunctionEnd
1620
- )" ;
1621
- CompileSuccessfully (text, SPV_ENV_VULKAN_1_3);
1622
- EXPECT_EQ (SPV_ERROR_INVALID_ID, ValidateInstructions (SPV_ENV_VULKAN_1_3));
1623
- EXPECT_THAT (getDiagnosticString (),
1624
- AnyVUID (" VUID-StandaloneSpirv-Input-09557" ));
1625
- EXPECT_THAT (getDiagnosticString (),
1626
- HasSubstr (" Input/Output interface variable id <2> contains a "
1627
- " PhysicalStorageBuffer pointer, which is not allowed" ));
1628
- }
1629
-
1630
- TEST_F (ValidateInterfacesTest, PhysicalStorageBufferPointerArray) {
1631
- const std::string text = R"(
1632
- OpCapability Shader
1633
- OpCapability PhysicalStorageBufferAddresses
1634
- OpMemoryModel PhysicalStorageBuffer64 GLSL450
1635
- OpEntryPoint Vertex %main "main" %var
1636
- OpDecorate %var Location 0
1637
- OpDecorate %var RestrictPointer
1638
- %void = OpTypeVoid
1639
- %uint = OpTypeInt 32 0
1640
- %uint_3 = OpConstant %uint 3
1641
- %psb_ptr = OpTypePointer PhysicalStorageBuffer %uint
1642
- %array = OpTypeArray %psb_ptr %uint_3
1643
- %in_ptr = OpTypePointer Input %array
1644
- %var = OpVariable %in_ptr Input
1645
- %void_fn = OpTypeFunction %void
1646
- %main = OpFunction %void None %void_fn
1647
- %entry = OpLabel
1648
- OpReturn
1649
- OpFunctionEnd
1650
- )" ;
1651
- CompileSuccessfully (text, SPV_ENV_VULKAN_1_3);
1652
- EXPECT_EQ (SPV_ERROR_INVALID_ID, ValidateInstructions (SPV_ENV_VULKAN_1_3));
1653
- EXPECT_THAT (getDiagnosticString (),
1654
- AnyVUID (" VUID-StandaloneSpirv-Input-09557" ));
1655
- EXPECT_THAT (getDiagnosticString (),
1656
- HasSubstr (" Input/Output interface variable id <2> contains a "
1657
- " PhysicalStorageBuffer pointer, which is not allowed" ));
1658
- }
1659
-
1660
- TEST_F (ValidateInterfacesTest, PhysicalStorageBufferPointerStruct) {
1661
- const std::string text = R"(
1662
- OpCapability Shader
1663
- OpCapability PhysicalStorageBufferAddresses
1664
- OpMemoryModel PhysicalStorageBuffer64 GLSL450
1665
- OpEntryPoint Vertex %main "main" %var
1666
- OpDecorate %var Location 0
1667
- OpDecorate %var RestrictPointer
1668
- %void = OpTypeVoid
1669
- %int = OpTypeInt 32 1
1670
- OpTypeForwardPointer %psb_ptr PhysicalStorageBuffer
1671
- %struct_0 = OpTypeStruct %int %psb_ptr
1672
- %struct_1 = OpTypeStruct %int %int
1673
- %psb_ptr = OpTypePointer PhysicalStorageBuffer %struct_1
1674
- %in_ptr = OpTypePointer Input %struct_0
1675
- %var = OpVariable %in_ptr Input
1676
- %void_fn = OpTypeFunction %void
1677
- %main = OpFunction %void None %void_fn
1678
- %entry = OpLabel
1679
- OpReturn
1680
- OpFunctionEnd
1681
- )" ;
1682
- CompileSuccessfully (text, SPV_ENV_VULKAN_1_3);
1683
- EXPECT_EQ (SPV_ERROR_INVALID_ID, ValidateInstructions (SPV_ENV_VULKAN_1_3));
1684
- EXPECT_THAT (getDiagnosticString (),
1685
- AnyVUID (" VUID-StandaloneSpirv-Input-09557" ));
1686
- EXPECT_THAT (getDiagnosticString (),
1687
- HasSubstr (" Input/Output interface variable id <2> contains a "
1688
- " PhysicalStorageBuffer pointer, which is not allowed" ));
1689
- }
1690
-
1691
- TEST_F (ValidateInterfacesTest, PhysicalStorageBufferPointerArrayOfStruct) {
1692
- const std::string text = R"(
1693
- OpCapability Shader
1694
- OpCapability PhysicalStorageBufferAddresses
1695
- OpMemoryModel PhysicalStorageBuffer64 GLSL450
1696
- OpEntryPoint Vertex %main "main" %var
1697
- OpDecorate %var Location 0
1698
- OpDecorate %var RestrictPointer
1699
- %void = OpTypeVoid
1700
- %int = OpTypeInt 32 1
1701
- %uint = OpTypeInt 32 0
1702
- %uint_3 = OpConstant %uint 3
1703
- OpTypeForwardPointer %psb_ptr PhysicalStorageBuffer
1704
- %array_1 = OpTypeArray %psb_ptr %uint_3
1705
- %struct_0 = OpTypeStruct %int %array_1
1706
- %struct_1 = OpTypeStruct %int %int
1707
- %psb_ptr = OpTypePointer PhysicalStorageBuffer %struct_1
1708
- %array_0 = OpTypeArray %struct_0 %uint_3
1709
- %in_ptr = OpTypePointer Input %array_0
1710
- %var = OpVariable %in_ptr Input
1711
- %void_fn = OpTypeFunction %void
1712
- %main = OpFunction %void None %void_fn
1713
- %entry = OpLabel
1714
- OpReturn
1715
- OpFunctionEnd
1716
- )" ;
1717
- CompileSuccessfully (text, SPV_ENV_VULKAN_1_3);
1718
- EXPECT_EQ (SPV_ERROR_INVALID_ID, ValidateInstructions (SPV_ENV_VULKAN_1_3));
1719
- EXPECT_THAT (getDiagnosticString (),
1720
- AnyVUID (" VUID-StandaloneSpirv-Input-09557" ));
1721
- EXPECT_THAT (getDiagnosticString (),
1722
- HasSubstr (" Input/Output interface variable id <2> contains a "
1723
- " PhysicalStorageBuffer pointer, which is not allowed" ));
1724
- }
1725
-
1726
- TEST_F (ValidateInterfacesTest, PhysicalStorageBufferPointerNestedStruct) {
1727
- const std::string text = R"(
1728
- OpCapability Shader
1729
- OpCapability PhysicalStorageBufferAddresses
1730
- OpMemoryModel PhysicalStorageBuffer64 GLSL450
1731
- OpEntryPoint Vertex %main "main" %var
1732
- OpDecorate %var Location 0
1733
- OpDecorate %var RestrictPointer
1734
- %void = OpTypeVoid
1735
- %int = OpTypeInt 32 1
1736
- OpTypeForwardPointer %psb_ptr PhysicalStorageBuffer
1737
- %struct_0 = OpTypeStruct %int %psb_ptr
1738
- %struct_1 = OpTypeStruct %int %int
1739
- %psb_ptr = OpTypePointer PhysicalStorageBuffer %struct_1
1740
- %struct_2 = OpTypeStruct %int %struct_0
1741
- %in_ptr = OpTypePointer Input %struct_2
1742
- %var = OpVariable %in_ptr Input
1611
+ %int = OpTypeInt 32 0
1612
+ %ptr = OpTypePointer PhysicalStorageBuffer %int
1613
+ %ptr2 = OpTypePointer Input %ptr
1614
+ %var = OpVariable %ptr2 Input
1743
1615
%void_fn = OpTypeFunction %void
1744
1616
%main = OpFunction %void None %void_fn
1745
1617
%entry = OpLabel
1746
1618
OpReturn
1747
1619
OpFunctionEnd
1748
1620
)" ;
1749
1621
CompileSuccessfully (text, SPV_ENV_VULKAN_1_3);
1750
- EXPECT_EQ (SPV_ERROR_INVALID_ID, ValidateInstructions (SPV_ENV_VULKAN_1_3));
1751
- EXPECT_THAT (getDiagnosticString (),
1752
- AnyVUID (" VUID-StandaloneSpirv-Input-09557" ));
1753
- EXPECT_THAT (getDiagnosticString (),
1754
- HasSubstr (" Input/Output interface variable id <2> contains a "
1755
- " PhysicalStorageBuffer pointer, which is not allowed" ));
1622
+ EXPECT_EQ (SPV_SUCCESS, ValidateInstructions (SPV_ENV_VULKAN_1_3));
1756
1623
}
1757
1624
1758
1625
} // namespace
0 commit comments