@@ -863,35 +863,6 @@ TEST(RootSignature, ParseRootFlags) {
863
863
FailedWithMessage (
864
864
" Invalid root signature, insufficient space for header." ));
865
865
}
866
- {
867
- // Version has been changed to an invalid number.
868
- uint8_t Buffer[] = {
869
- 0x44 , 0x58 , 0x42 , 0x43 , 0x32 , 0x9A , 0x53 , 0xD8 , 0xEC , 0xBE , 0x35 , 0x6F ,
870
- 0x05 , 0x39 , 0xE1 , 0xFE , 0x31 , 0x20 , 0xF0 , 0xC1 , 0x01 , 0x00 , 0x00 , 0x00 ,
871
- 0x44 , 0x00 , 0x00 , 0x00 , 0x01 , 0x00 , 0x00 , 0x00 , 0x24 , 0x00 , 0x00 , 0x00 ,
872
- 0x52 , 0x54 , 0x53 , 0x30 , 0x18 , 0x00 , 0x00 , 0x00 , 0x03 , 0x00 , 0x00 , 0x00 ,
873
- 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
874
- 0x00 , 0x00 , 0x00 , 0x00 , 0x01 , 0x00 , 0x00 , 0x00 ,
875
- };
876
- EXPECT_THAT_EXPECTED (
877
- DXContainer::create (getMemoryBuffer<100 >(Buffer)),
878
- FailedWithMessage (" unsupported root signature version read: 3" ));
879
- }
880
- {
881
- // Flag has been set to an invalid value
882
- uint8_t Buffer[] = {
883
- 0x44 , 0x58 , 0x42 , 0x43 , 0x32 , 0x9A , 0x53 , 0xD8 , 0xEC , 0xBE , 0x35 , 0x6F ,
884
- 0x05 , 0x39 , 0xE1 , 0xFE , 0x31 , 0x20 , 0xF0 , 0xC1 , 0x01 , 0x00 , 0x00 , 0x00 ,
885
- 0x44 , 0x00 , 0x00 , 0x00 , 0x01 , 0x00 , 0x00 , 0x00 , 0x24 , 0x00 , 0x00 , 0x00 ,
886
- 0x52 , 0x54 , 0x53 , 0x30 , 0x18 , 0x00 , 0x00 , 0x00 , 0x02 , 0x00 , 0x00 , 0x00 ,
887
- 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
888
- 0x00 , 0x00 , 0x00 , 0x00 , 0x01 , 0x00 , 0x00 , 0xFF ,
889
- };
890
- EXPECT_THAT_EXPECTED (
891
- DXContainer::create (getMemoryBuffer<100 >(Buffer)),
892
- FailedWithMessage (
893
- " unsupported root signature flag value read: 4278190081" ));
894
- }
895
866
}
896
867
897
868
TEST (RootSignature, ParseRootConstant) {
@@ -939,69 +910,4 @@ TEST(RootSignature, ParseRootConstant) {
939
910
ASSERT_EQ (Constants->Space , 14u );
940
911
ASSERT_EQ (Constants->NumOfConstants , 16u );
941
912
}
942
- {
943
- // ParameterType has been set to an invalid value
944
- uint8_t Buffer[] = {
945
- 0x44 , 0x58 , 0x42 , 0x43 , 0x32 , 0x9a , 0x53 , 0xd8 , 0xec , 0xbe , 0x35 , 0x6f ,
946
- 0x05 , 0x39 , 0xe1 , 0xfe , 0x31 , 0x20 , 0xf0 , 0xc1 , 0x01 , 0x00 , 0x00 , 0x00 ,
947
- 0x85 , 0x00 , 0x00 , 0x00 , 0x01 , 0x00 , 0x00 , 0x00 , 0x24 , 0x00 , 0x00 , 0x00 ,
948
- 0x52 , 0x54 , 0x53 , 0x30 , 0x59 , 0x00 , 0x00 , 0x00 , 0x02 , 0x00 , 0x00 , 0x00 ,
949
- 0x01 , 0x00 , 0x00 , 0x00 , 0x18 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
950
- 0x2c , 0x00 , 0x00 , 0x00 , 0x11 , 0x00 , 0x00 , 0x00 , 0xFF , 0x00 , 0x00 , 0x00 ,
951
- 0x02 , 0x00 , 0x00 , 0x00 , 0x24 , 0x00 , 0x00 , 0x00 , 0x0f , 0x00 , 0x00 , 0x00 ,
952
- 0x0e , 0x00 , 0x00 , 0x00 , 0x10 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
953
- 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
954
- 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
955
- 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
956
- 0x00 };
957
- EXPECT_THAT_EXPECTED (
958
- DXContainer::create (getMemoryBuffer<133 >(Buffer)),
959
- FailedWithMessage (" unsupported parameter type value read: 255" ));
960
- }
961
- {
962
- // ShaderVisibility has been set to an invalid value
963
- uint8_t Buffer[] = {
964
- 0x44 , 0x58 , 0x42 , 0x43 , 0x32 , 0x9a , 0x53 , 0xd8 , 0xec , 0xbe , 0x35 , 0x6f ,
965
- 0x05 , 0x39 , 0xe1 , 0xfe , 0x31 , 0x20 , 0xf0 , 0xc1 , 0x01 , 0x00 , 0x00 , 0x00 ,
966
- 0x85 , 0x00 , 0x00 , 0x00 , 0x01 , 0x00 , 0x00 , 0x00 , 0x24 , 0x00 , 0x00 , 0x00 ,
967
- 0x52 , 0x54 , 0x53 , 0x30 , 0x59 , 0x00 , 0x00 , 0x00 , 0x02 , 0x00 , 0x00 , 0x00 ,
968
- 0x01 , 0x00 , 0x00 , 0x00 , 0x18 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
969
- 0x2c , 0x00 , 0x00 , 0x00 , 0x11 , 0x00 , 0x00 , 0x00 , 0x01 , 0x00 , 0x00 , 0x00 ,
970
- 0xFF , 0x00 , 0x00 , 0x00 , 0x24 , 0x00 , 0x00 , 0x00 , 0x0f , 0x00 , 0x00 , 0x00 ,
971
- 0x0e , 0x00 , 0x00 , 0x00 , 0x10 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
972
- 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
973
- 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
974
- 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
975
- 0x00 };
976
- EXPECT_THAT_EXPECTED (
977
- DXContainer::create (getMemoryBuffer<133 >(Buffer)),
978
- FailedWithMessage (" unsupported shader visility flag value read: 255" ));
979
- }
980
- {
981
- // Offset has been set to an invalid value
982
- uint8_t Buffer[] = {
983
- 0x44 , 0x58 , 0x42 , 0x43 , 0x32 , 0x9a , 0x53 , 0xd8 , 0xec , 0xbe , 0x35 , 0x6f ,
984
- 0x05 , 0x39 , 0xe1 , 0xfe , 0x31 , 0x20 , 0xf0 , 0xc1 , 0x01 , 0x00 , 0x00 , 0x00 ,
985
- 0x85 , 0x00 , 0x00 , 0x00 , 0x01 , 0x00 , 0x00 , 0x00 , 0x24 , 0x00 , 0x00 , 0x00 ,
986
- 0x52 , 0x54 , 0x53 , 0x30 , 0x59 , 0x00 , 0x00 , 0x00 , 0x02 , 0x00 , 0x00 , 0x00 ,
987
- 0x01 , 0x00 , 0x00 , 0x00 , 0x18 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
988
- 0x2c , 0x00 , 0x00 , 0x00 , 0x11 , 0x00 , 0x00 , 0x00 , 0x01 , 0x00 , 0x00 , 0x00 ,
989
- 0x02 , 0x00 , 0x00 , 0x00 , 0x4e , 0x00 , 0x00 , 0x00 , 0x0f , 0x00 , 0x00 , 0x00 ,
990
- 0x0e , 0x00 , 0x00 , 0x00 , 0x10 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
991
- 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
992
- 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
993
- 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
994
- 0x00 };
995
- DXContainer C =
996
- llvm::cantFail (DXContainer::create (getMemoryBuffer<133 >(Buffer)));
997
-
998
- auto MaybeRS = C.getRootSignature ();
999
- ASSERT_TRUE (MaybeRS.has_value ());
1000
- const auto &RS = MaybeRS.value ();
1001
- auto RootParam = *RS.param_header ().begin ();
1002
- auto ParamView = RS.getParameter (RootParam);
1003
- ASSERT_THAT_ERROR (
1004
- ParamView.takeError (),
1005
- FailedWithMessage (" Reading structure out of file bounds" ));
1006
- }
1007
913
}
0 commit comments