forked from KhronosGroup/Vulkan-ValidationLayers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vklayertests_video.cpp
4521 lines (3449 loc) · 177 KB
/
vklayertests_video.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Copyright (c) 2022 The Khronos Group Inc.
* Copyright (c) 2022 RasterGrid Kft.
*
* 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
*
* Author: Daniel Rakos <[email protected]>
*/
#include "vklayertests_video.h"
#include <algorithm>
#include <array>
#include <chrono>
#include <memory>
#include <mutex>
#include <thread>
#include "cast_utils.h"
TEST_F(VkVideoLayerTest, VideoCodingScope) {
TEST_DESCRIPTION("Tests calling functions inside/outside video coding scope");
ASSERT_NO_FATAL_FAILURE(Init());
VideoConfig config = GetConfig();
if (!config) {
GTEST_SKIP() << "Test requires video support";
}
VideoContext context(DeviceObj(), config);
context.CreateAndBindSessionMemory();
VkCommandBufferObj& cb = context.CmdBuffer();
// Video coding block must be ended before command buffer
cb.begin();
cb.BeginVideoCoding(context.Begin());
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-vkEndCommandBuffer-None-06991");
vk::EndCommandBuffer(cb.handle());
m_errorMonitor->VerifyFound();
cb.EndVideoCoding(context.End());
cb.end();
// vkCmdEndVideoCoding not allowed outside video coding block
cb.begin();
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-vkCmdEndVideoCodingKHR-videocoding");
cb.EndVideoCoding(context.End());
m_errorMonitor->VerifyFound();
cb.end();
// vkCmdBeginVideoCoding not allowed inside video coding block
cb.begin();
cb.BeginVideoCoding(context.Begin());
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-vkCmdBeginVideoCodingKHR-videocoding");
cb.BeginVideoCoding(context.Begin());
m_errorMonitor->VerifyFound();
cb.EndVideoCoding(context.End());
cb.end();
// vkCmdControlVideoCoding not allowed outside video coding block
cb.begin();
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-vkCmdControlVideoCodingKHR-videocoding");
cb.ControlVideoCoding(context.Control().Reset());
m_errorMonitor->VerifyFound();
cb.end();
}
TEST_F(VkVideoLayerTest, VideoProfileInvalidLumaChromaSubsampling) {
TEST_DESCRIPTION("Test single bit set in VkVideoProfileInfoKHR chromaSubsampling, lumaBitDepth, and chromaBitDepth");
ASSERT_NO_FATAL_FAILURE(Init());
VideoConfig config = GetConfig();
if (!config) {
GTEST_SKIP() << "Test requires video support";
}
VkVideoProfileInfoKHR profile;
// Multiple bits in chromaSubsampling
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkVideoProfileInfoKHR-chromaSubsampling-07013");
profile = *config.Profile();
profile.chromaSubsampling = VK_VIDEO_CHROMA_SUBSAMPLING_420_BIT_KHR | VK_VIDEO_CHROMA_SUBSAMPLING_422_BIT_KHR;
vk.GetPhysicalDeviceVideoCapabilitiesKHR(gpu(), &profile, config.Caps());
m_errorMonitor->VerifyFound();
// Multiple bits in lumaBitDepth
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkVideoProfileInfoKHR-lumaBitDepth-07014");
profile = *config.Profile();
profile.lumaBitDepth = VK_VIDEO_COMPONENT_BIT_DEPTH_8_BIT_KHR | VK_VIDEO_COMPONENT_BIT_DEPTH_10_BIT_KHR;
vk.GetPhysicalDeviceVideoCapabilitiesKHR(gpu(), &profile, config.Caps());
m_errorMonitor->VerifyFound();
// Multiple bits in chromaBitDepth
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkVideoProfileInfoKHR-chromaSubsampling-07015");
profile = *config.Profile();
profile.chromaSubsampling = VK_VIDEO_CHROMA_SUBSAMPLING_420_BIT_KHR;
profile.chromaBitDepth = VK_VIDEO_COMPONENT_BIT_DEPTH_8_BIT_KHR | VK_VIDEO_COMPONENT_BIT_DEPTH_10_BIT_KHR;
vk.GetPhysicalDeviceVideoCapabilitiesKHR(gpu(), &profile, config.Caps());
m_errorMonitor->VerifyFound();
}
TEST_F(VkVideoLayerTest, VideoProfileMissingCodecInfo) {
TEST_DESCRIPTION("Test missing codec-specific structure in profile definition");
ASSERT_NO_FATAL_FAILURE(Init());
VkVideoProfileInfoKHR profile;
if (GetConfigDecodeH264()) {
VideoConfig config = GetConfigDecodeH264();
profile = *config.Profile();
profile.pNext = nullptr;
// Missing codec-specific info for H.264 decode profile
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkVideoProfileInfoKHR-videoCodecOperation-07179");
vk.GetPhysicalDeviceVideoCapabilitiesKHR(gpu(), &profile, config.Caps());
m_errorMonitor->VerifyFound();
}
if (GetConfigDecodeH265()) {
VideoConfig config = GetConfigDecodeH265();
profile = *config.Profile();
profile.pNext = nullptr;
// Missing codec-specific info for H.265 decode profile
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkVideoProfileInfoKHR-videoCodecOperation-07180");
vk.GetPhysicalDeviceVideoCapabilitiesKHR(gpu(), &profile, config.Caps());
m_errorMonitor->VerifyFound();
}
}
TEST_F(VkVideoLayerTest, CapabilityQueryMissingChain) {
TEST_DESCRIPTION("vkGetPhysicalDeviceVideoCapabilitiesKHR - missing return structures in chain");
ASSERT_NO_FATAL_FAILURE(Init());
if (GetConfigDecodeH264()) {
VideoConfig config = GetConfigDecodeH264();
auto caps = LvlInitStruct<VkVideoCapabilitiesKHR>();
auto decode_caps = LvlInitStruct<VkVideoDecodeCapabilitiesKHR>();
auto decode_h264_caps = LvlInitStruct<VkVideoDecodeH264CapabilitiesKHR>();
// Missing decode caps struct for decode profile
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-vkGetPhysicalDeviceVideoCapabilitiesKHR-pVideoProfile-07183");
caps.pNext = &decode_h264_caps;
vk.GetPhysicalDeviceVideoCapabilitiesKHR(gpu(), config.Profile(), &caps);
m_errorMonitor->VerifyFound();
// Missing H.264 decode caps struct for H.264 decode profile
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-vkGetPhysicalDeviceVideoCapabilitiesKHR-pVideoProfile-07184");
caps.pNext = &decode_caps;
vk.GetPhysicalDeviceVideoCapabilitiesKHR(gpu(), config.Profile(), &caps);
m_errorMonitor->VerifyFound();
}
if (GetConfigDecodeH265()) {
VideoConfig config = GetConfigDecodeH265();
auto caps = LvlInitStruct<VkVideoCapabilitiesKHR>();
auto decode_caps = LvlInitStruct<VkVideoDecodeCapabilitiesKHR>();
auto decode_h265_caps = LvlInitStruct<VkVideoDecodeH265CapabilitiesKHR>();
// Missing decode caps struct for decode profile
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-vkGetPhysicalDeviceVideoCapabilitiesKHR-pVideoProfile-07183");
caps.pNext = &decode_h265_caps;
vk.GetPhysicalDeviceVideoCapabilitiesKHR(gpu(), config.Profile(), &caps);
m_errorMonitor->VerifyFound();
// Missing H.265 decode caps struct for H.265 decode profile
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-vkGetPhysicalDeviceVideoCapabilitiesKHR-pVideoProfile-07185");
caps.pNext = &decode_caps;
vk.GetPhysicalDeviceVideoCapabilitiesKHR(gpu(), config.Profile(), &caps);
m_errorMonitor->VerifyFound();
}
}
TEST_F(VkVideoLayerTest, VideoFormatQueryMissingProfile) {
TEST_DESCRIPTION("vkGetPhysicalDeviceVideoFormatPropertiesKHR - missing profile info");
ASSERT_NO_FATAL_FAILURE(Init());
if (!GetConfig()) {
GTEST_SKIP() << "Test requires video support";
}
auto format_info = LvlInitStruct<VkPhysicalDeviceVideoFormatInfoKHR>();
format_info.imageUsage = VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR;
uint32_t format_count = 0;
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-vkGetPhysicalDeviceVideoFormatPropertiesKHR-pNext-06812");
vk.GetPhysicalDeviceVideoFormatPropertiesKHR(gpu(), &format_info, &format_count, nullptr);
m_errorMonitor->VerifyFound();
auto profile_list = LvlInitStruct<VkVideoProfileListInfoKHR>();
format_info.pNext = &profile_list;
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-vkGetPhysicalDeviceVideoFormatPropertiesKHR-pNext-06812");
vk.GetPhysicalDeviceVideoFormatPropertiesKHR(gpu(), &format_info, &format_count, nullptr);
m_errorMonitor->VerifyFound();
}
TEST_F(VkVideoLayerTest, InUseDestroyed) {
TEST_DESCRIPTION("Test destroying objects while they are still in use");
ASSERT_NO_FATAL_FAILURE(Init());
VideoConfig config = GetConfigWithParams(GetConfigs());
if (!config) {
config = GetConfig();
}
if (!config) {
GTEST_SKIP() << "Test requires video support";
}
VideoContext context(DeviceObj(), config);
context.CreateAndBindSessionMemory();
context.CreateResources();
VkCommandBufferObj& cb = context.CmdBuffer();
cb.begin();
cb.BeginVideoCoding(context.Begin());
cb.ControlVideoCoding(context.Control().Reset());
cb.EndVideoCoding(context.End());
cb.end();
context.Queue().submit(cb);
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-vkDestroyVideoSessionKHR-videoSession-07192");
context.vk.DestroyVideoSessionKHR(m_device->device(), context.Session(), nullptr);
m_errorMonitor->VerifyFound();
if (config.NeedsSessionParams()) {
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-vkDestroyVideoSessionParametersKHR-videoSessionParameters-07212");
context.vk.DestroyVideoSessionParametersKHR(m_device->device(), context.SessionParams(), nullptr);
m_errorMonitor->VerifyFound();
}
m_device->wait();
}
TEST_F(VkVideoLayerTest, CreateSessionProtectedMemoryNotEnabled) {
TEST_DESCRIPTION("vkCreateVideoSessionKHR - cannot enable protected content without protected memory");
ASSERT_NO_FATAL_FAILURE(Init());
VideoConfig config = GetConfig();
if (!config) {
GTEST_SKIP() << "Test requires video support";
}
VideoContext context(DeviceObj(), config);
VkVideoSessionKHR session;
VkVideoSessionCreateInfoKHR create_info = *config.SessionCreateInfo();
create_info.flags = VK_VIDEO_SESSION_CREATE_PROTECTED_CONTENT_BIT_KHR;
create_info.pVideoProfile = config.Profile();
create_info.pStdHeaderVersion = config.StdVersion();
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkVideoSessionCreateInfoKHR-protectedMemory-07189");
context.vk.CreateVideoSessionKHR(m_device->device(), &create_info, nullptr, &session);
m_errorMonitor->VerifyFound();
}
TEST_F(VkVideoLayerTest, CreateSessionProtectedContentUnsupported) {
TEST_DESCRIPTION("vkCreateVideoSessionKHR - cannot enable protected content if not supported");
const bool enable_protected_memory = true;
ASSERT_NO_FATAL_FAILURE(Init(enable_protected_memory));
if (!IsProtectedMemoryEnabled()) {
GTEST_SKIP() << "Test requires protectedMemory support";
}
VideoConfig config = GetConfigWithProtectedContent(GetConfigs());
if (!config) {
GTEST_SKIP() << "Test requires a video profile with protected content support";
}
VideoContext context(DeviceObj(), config);
VkVideoSessionKHR session;
VkVideoSessionCreateInfoKHR create_info = *config.SessionCreateInfo();
create_info.flags = VK_VIDEO_SESSION_CREATE_PROTECTED_CONTENT_BIT_KHR;
create_info.pVideoProfile = config.Profile();
create_info.pStdHeaderVersion = config.StdVersion();
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkVideoSessionCreateInfoKHR-protectedMemory-07189");
context.vk.CreateVideoSessionKHR(m_device->device(), &create_info, nullptr, &session);
m_errorMonitor->VerifyFound();
}
TEST_F(VkVideoLayerTest, CreateSessionUnsupportedProfile) {
TEST_DESCRIPTION("vkCreateVideoSessionKHR - unsupported profile");
ASSERT_NO_FATAL_FAILURE(Init());
VideoConfig config;
VkVideoProfileInfoKHR profile;
VkVideoDecodeH264ProfileInfoKHR profile_h264;
VkVideoDecodeH265ProfileInfoKHR profile_h265;
if (GetConfigDecodeH264()) {
config = GetConfigDecodeH264();
profile = *config.Profile();
profile_h264 = *LvlFindInChain<VkVideoDecodeH264ProfileInfoKHR>(profile.pNext);
profile.pNext = &profile_h264;
profile_h264.stdProfileIdc = STD_VIDEO_H264_PROFILE_IDC_INVALID;
} else if (GetConfigDecodeH265()) {
config = GetConfigDecodeH265();
profile = *config.Profile();
profile_h265 = *LvlFindInChain<VkVideoDecodeH265ProfileInfoKHR>(profile.pNext);
profile.pNext = &profile_h265;
profile_h265.stdProfileIdc = STD_VIDEO_H265_PROFILE_IDC_INVALID;
} else {
GTEST_SKIP() << "Test requires support for H.264 or H.265 decode";
}
VideoContext context(DeviceObj(), config);
VkVideoSessionCreateInfoKHR create_info = *config.SessionCreateInfo();
create_info.pVideoProfile = &profile;
create_info.pStdHeaderVersion = config.StdVersion();
VkVideoSessionKHR session;
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkVideoSessionCreateInfoKHR-pVideoProfile-04845");
context.vk.CreateVideoSessionKHR(m_device->device(), &create_info, nullptr, &session);
m_errorMonitor->VerifyFound();
}
TEST_F(VkVideoLayerTest, CreateSessionInvalidReferencePictureCounts) {
TEST_DESCRIPTION("vkCreateVideoSessionKHR - invalid reference picture slot and active counts");
ASSERT_NO_FATAL_FAILURE(Init());
VideoConfig config = GetConfig();
if (!config) {
GTEST_SKIP() << "Test requires video support";
}
VideoContext context(DeviceObj(), config);
VkVideoSessionKHR session;
VkVideoSessionCreateInfoKHR create_info = *config.SessionCreateInfo();
create_info.pVideoProfile = config.Profile();
create_info.pStdHeaderVersion = config.StdVersion();
create_info.maxDpbSlots = config.Caps()->maxDpbSlots;
create_info.maxActiveReferencePictures = config.Caps()->maxActiveReferencePictures;
// maxDpbSlots too big
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkVideoSessionCreateInfoKHR-maxDpbSlots-04847");
create_info.maxDpbSlots++;
context.vk.CreateVideoSessionKHR(m_device->device(), &create_info, nullptr, &session);
create_info.maxDpbSlots--;
m_errorMonitor->VerifyFound();
// maxActiveReferencePictures too big
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkVideoSessionCreateInfoKHR-maxActiveReferencePictures-04849");
create_info.maxActiveReferencePictures++;
context.vk.CreateVideoSessionKHR(m_device->device(), &create_info, nullptr, &session);
create_info.maxActiveReferencePictures--;
m_errorMonitor->VerifyFound();
config = GetConfig(GetConfigsWithReferences(GetConfigs()));
if (config) {
// maxDpbSlots is 0, but maxActiveReferencePictures is not
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkVideoSessionCreateInfoKHR-maxDpbSlots-04850");
create_info.maxDpbSlots = 0;
create_info.maxActiveReferencePictures = 1;
context.vk.CreateVideoSessionKHR(m_device->device(), &create_info, nullptr, &session);
m_errorMonitor->VerifyFound();
// maxActiveReferencePictures is 0, but maxDpbSlots is not
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkVideoSessionCreateInfoKHR-maxDpbSlots-04850");
create_info.maxDpbSlots = 1;
create_info.maxActiveReferencePictures = 0;
context.vk.CreateVideoSessionKHR(m_device->device(), &create_info, nullptr, &session);
m_errorMonitor->VerifyFound();
}
}
TEST_F(VkVideoLayerTest, CreateSessionInvalidMaxCodedExtent) {
TEST_DESCRIPTION("vkCreateVideoSessionKHR - maxCodedExtent outside of supported range");
ASSERT_NO_FATAL_FAILURE(Init());
VideoConfig config = GetConfig();
if (!config) {
GTEST_SKIP() << "Test requires video support";
}
VideoContext context(DeviceObj(), config);
VkVideoSessionKHR session;
VkVideoSessionCreateInfoKHR create_info = *config.SessionCreateInfo();
create_info.pVideoProfile = config.Profile();
create_info.pStdHeaderVersion = config.StdVersion();
// maxCodedExtent.width too small
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkVideoSessionCreateInfoKHR-maxCodedExtent-04851");
create_info.maxCodedExtent = config.Caps()->minCodedExtent;
--create_info.maxCodedExtent.width;
context.vk.CreateVideoSessionKHR(m_device->device(), &create_info, nullptr, &session);
m_errorMonitor->VerifyFound();
// maxCodedExtent.height too small
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkVideoSessionCreateInfoKHR-maxCodedExtent-04851");
create_info.maxCodedExtent = config.Caps()->minCodedExtent;
--create_info.maxCodedExtent.height;
context.vk.CreateVideoSessionKHR(m_device->device(), &create_info, nullptr, &session);
m_errorMonitor->VerifyFound();
// maxCodedExtent.width too big
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkVideoSessionCreateInfoKHR-maxCodedExtent-04851");
create_info.maxCodedExtent = config.Caps()->maxCodedExtent;
++create_info.maxCodedExtent.width;
context.vk.CreateVideoSessionKHR(m_device->device(), &create_info, nullptr, &session);
m_errorMonitor->VerifyFound();
// maxCodedExtent.height too big
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkVideoSessionCreateInfoKHR-maxCodedExtent-04851");
create_info.maxCodedExtent = config.Caps()->maxCodedExtent;
++create_info.maxCodedExtent.height;
context.vk.CreateVideoSessionKHR(m_device->device(), &create_info, nullptr, &session);
m_errorMonitor->VerifyFound();
}
TEST_F(VkVideoLayerTest, CreateSessionInvalidDecodeReferencePictureFormat) {
TEST_DESCRIPTION("vkCreateVideoSessionKHR - invalid decode reference picture format");
ASSERT_NO_FATAL_FAILURE(Init());
VideoConfig config = GetConfig(GetConfigsWithReferences(GetConfigsDecode()));
if (!config) {
GTEST_SKIP() << "Test requires video decode support with reference pictures";
}
config.SessionCreateInfo()->maxDpbSlots = 1;
config.SessionCreateInfo()->maxActiveReferencePictures = 1;
VideoContext context(DeviceObj(), config);
VkVideoSessionKHR session;
VkVideoSessionCreateInfoKHR create_info = *config.SessionCreateInfo();
create_info.pVideoProfile = config.Profile();
create_info.pStdHeaderVersion = config.StdVersion();
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkVideoSessionCreateInfoKHR-referencePictureFormat-04852");
create_info.referencePictureFormat = VK_FORMAT_D16_UNORM;
context.vk.CreateVideoSessionKHR(m_device->device(), &create_info, nullptr, &session);
m_errorMonitor->VerifyFound();
}
TEST_F(VkVideoLayerTest, CreateSessionInvalidDecodePictureFormat) {
TEST_DESCRIPTION("vkCreateVideoSessionKHR - invalid decode picture format");
ASSERT_NO_FATAL_FAILURE(Init());
VideoConfig config = GetConfigDecode();
if (!config) {
GTEST_SKIP() << "Test requires video decode support";
}
VideoContext context(DeviceObj(), config);
VkVideoSessionKHR session;
VkVideoSessionCreateInfoKHR create_info = *config.SessionCreateInfo();
create_info.pVideoProfile = config.Profile();
create_info.pStdHeaderVersion = config.StdVersion();
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkVideoSessionCreateInfoKHR-pictureFormat-04853");
create_info.pictureFormat = VK_FORMAT_D16_UNORM;
context.vk.CreateVideoSessionKHR(m_device->device(), &create_info, nullptr, &session);
m_errorMonitor->VerifyFound();
}
TEST_F(VkVideoLayerTest, CreateSessionInvalidStdHeaderVersion) {
TEST_DESCRIPTION("vkCreateVideoSessionKHR - invalid Video Std header version");
ASSERT_NO_FATAL_FAILURE(Init());
VideoConfig config = GetConfig();
if (!config) {
GTEST_SKIP() << "Test requires video support";
}
VideoContext context(DeviceObj(), config);
VkVideoSessionKHR session;
VkVideoSessionCreateInfoKHR create_info = *config.SessionCreateInfo();
VkExtensionProperties std_version = *config.StdVersion();
create_info.pVideoProfile = config.Profile();
create_info.pStdHeaderVersion = &std_version;
// Video Std header version not supported
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkVideoSessionCreateInfoKHR-pStdHeaderVersion-07191");
++std_version.specVersion;
context.vk.CreateVideoSessionKHR(m_device->device(), &create_info, nullptr, &session);
--std_version.specVersion;
m_errorMonitor->VerifyFound();
// Video Std header name not supported
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkVideoSessionCreateInfoKHR-pStdHeaderVersion-07190");
strcpy(std_version.extensionName, "invalid_std_header_name");
context.vk.CreateVideoSessionKHR(m_device->device(), &create_info, nullptr, &session);
m_errorMonitor->VerifyFound();
}
TEST_F(VkVideoLayerTest, BindVideoSessionMemory) {
TEST_DESCRIPTION("vkBindVideoSessionMemoryKHR - memory binding related invalid usages");
ASSERT_NO_FATAL_FAILURE(Init());
VideoConfig config = GetConfig();
if (!config) {
GTEST_SKIP() << "Test requires video support";
}
VideoContext context(DeviceObj(), config);
uint32_t mem_req_count;
ASSERT_VK_SUCCESS(
context.vk.GetVideoSessionMemoryRequirementsKHR(m_device->device(), context.Session(), &mem_req_count, nullptr));
if (mem_req_count == 0) {
GTEST_SKIP() << "Test can only run if video session needs memory bindings";
}
std::vector<VkVideoSessionMemoryRequirementsKHR> mem_reqs(mem_req_count, LvlInitStruct<VkVideoSessionMemoryRequirementsKHR>());
ASSERT_VK_SUCCESS(
context.vk.GetVideoSessionMemoryRequirementsKHR(m_device->device(), context.Session(), &mem_req_count, mem_reqs.data()));
std::vector<VkDeviceMemory> session_memory;
std::vector<VkBindVideoSessionMemoryInfoKHR> bind_info(mem_req_count, LvlInitStruct<VkBindVideoSessionMemoryInfoKHR>());
for (uint32_t i = 0; i < mem_req_count; ++i) {
VkMemoryAllocateInfo alloc_info = LvlInitStruct<VkMemoryAllocateInfo>();
ASSERT_TRUE(m_device->phy().set_memory_type(mem_reqs[i].memoryRequirements.memoryTypeBits, &alloc_info, 0));
alloc_info.allocationSize = mem_reqs[i].memoryRequirements.size * 2;
VkDeviceMemory memory = VK_NULL_HANDLE;
ASSERT_VK_SUCCESS(vk::AllocateMemory(m_device->device(), &alloc_info, nullptr, &memory));
session_memory.push_back(memory);
bind_info[i].memoryBindIndex = mem_reqs[i].memoryBindIndex;
bind_info[i].memory = memory;
bind_info[i].memoryOffset = 0;
bind_info[i].memorySize = mem_reqs[i].memoryRequirements.size;
}
// Duplicate memoryBindIndex
if (mem_req_count > 1) {
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-vkBindVideoSessionMemoryKHR-memoryBindIndex-07196");
auto& duplicate = bind_info[mem_req_count / 2];
auto backup = duplicate;
duplicate = bind_info[0];
context.vk.BindVideoSessionMemoryKHR(m_device->device(), context.Session(), mem_req_count, bind_info.data());
duplicate = backup;
m_errorMonitor->VerifyFound();
}
// Invalid memoryBindIndex
uint32_t invalid_bind_index = UINT32_MAX;
for (uint32_t i = 0; i < mem_req_count; ++i) {
if (mem_reqs[i].memoryBindIndex < UINT32_MAX) {
invalid_bind_index = mem_reqs[i].memoryBindIndex + 1;
}
}
if (invalid_bind_index != UINT32_MAX) {
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-vkBindVideoSessionMemoryKHR-pBindSessionMemoryInfos-07197");
auto& invalid = bind_info[mem_req_count / 2];
auto backup = invalid;
invalid.memoryBindIndex = invalid_bind_index;
context.vk.BindVideoSessionMemoryKHR(m_device->device(), context.Session(), mem_req_count, bind_info.data());
invalid = backup;
m_errorMonitor->VerifyFound();
}
// Incompatible memory type
uint32_t invalid_mem_type_index = UINT32_MAX;
uint32_t invalid_mem_type_req_index = UINT32_MAX;
auto mem_props = m_device->phy().memory_properties();
for (uint32_t i = 0; i < mem_req_count; ++i) {
uint32_t mem_type_bits = mem_reqs[i].memoryRequirements.memoryTypeBits;
for (uint32_t mem_type_index = 0; mem_type_index < mem_props.memoryTypeCount; ++mem_type_index) {
if ((mem_type_bits & (1 << mem_type_index)) == 0) {
invalid_mem_type_index = mem_type_index;
invalid_mem_type_req_index = i;
break;
}
}
if (invalid_mem_type_index != UINT32_MAX) break;
}
if (invalid_mem_type_index != UINT32_MAX) {
auto& mem_req = mem_reqs[invalid_mem_type_req_index].memoryRequirements;
VkMemoryAllocateInfo alloc_info = LvlInitStruct<VkMemoryAllocateInfo>();
alloc_info.memoryTypeIndex = invalid_mem_type_index;
alloc_info.allocationSize = mem_req.size * 2;
VkDeviceMemory memory = VK_NULL_HANDLE;
ASSERT_VK_SUCCESS(vk::AllocateMemory(m_device->device(), &alloc_info, nullptr, &memory));
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-vkBindVideoSessionMemoryKHR-pBindSessionMemoryInfos-07198");
auto& invalid = bind_info[invalid_mem_type_req_index];
auto backup = invalid;
invalid.memory = memory;
context.vk.BindVideoSessionMemoryKHR(m_device->device(), context.Session(), mem_req_count, bind_info.data());
invalid = backup;
m_errorMonitor->VerifyFound();
vk::FreeMemory(m_device->device(), memory, nullptr);
}
// Incorrectly aligned memoryOffset
uint32_t invalid_offset_align_index = UINT32_MAX;
for (uint32_t i = 0; i < mem_req_count; ++i) {
if (mem_reqs[i].memoryRequirements.alignment > 1) {
invalid_offset_align_index = i;
break;
}
}
if (invalid_offset_align_index != UINT32_MAX) {
auto& mem_req = mem_reqs[invalid_offset_align_index].memoryRequirements;
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-vkBindVideoSessionMemoryKHR-pBindSessionMemoryInfos-07199");
auto& invalid = bind_info[invalid_offset_align_index];
auto backup = invalid;
invalid.memoryOffset = mem_req.alignment / 2;
context.vk.BindVideoSessionMemoryKHR(m_device->device(), context.Session(), mem_req_count, bind_info.data());
invalid = backup;
m_errorMonitor->VerifyFound();
}
// Incorrect memorySize
{
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-vkBindVideoSessionMemoryKHR-pBindSessionMemoryInfos-07200");
auto& invalid = bind_info[mem_req_count / 2];
auto backup = invalid;
invalid.memorySize += 16;
context.vk.BindVideoSessionMemoryKHR(m_device->device(), context.Session(), mem_req_count, bind_info.data());
invalid = backup;
m_errorMonitor->VerifyFound();
}
// Out-of-bounds memoryOffset
{
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkBindVideoSessionMemoryInfoKHR-memoryOffset-07201");
auto& invalid = bind_info[mem_req_count / 2];
auto backup = invalid;
invalid.memoryOffset = invalid.memorySize * 2;
context.vk.BindVideoSessionMemoryKHR(m_device->device(), context.Session(), mem_req_count, bind_info.data());
invalid = backup;
m_errorMonitor->VerifyFound();
}
// Out-of-bounds memoryOffset + memorySize
{
uint32_t index = mem_req_count / 2;
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkBindVideoSessionMemoryInfoKHR-memorySize-07202");
m_errorMonitor->SetAllowedFailureMsg("VUID-vkBindVideoSessionMemoryKHR-pBindSessionMemoryInfos-07199");
auto& invalid = bind_info[index];
auto backup = invalid;
invalid.memoryOffset = invalid.memorySize + 1;
context.vk.BindVideoSessionMemoryKHR(m_device->device(), context.Session(), mem_req_count, bind_info.data());
invalid = backup;
m_errorMonitor->VerifyFound();
}
// Already bound
{
uint32_t first_bind_count = mem_req_count / 2;
if (first_bind_count == 0) {
first_bind_count = 1;
}
context.vk.BindVideoSessionMemoryKHR(m_device->device(), context.Session(), first_bind_count, bind_info.data());
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-vkBindVideoSessionMemoryKHR-videoSession-07195");
context.vk.BindVideoSessionMemoryKHR(m_device->device(), context.Session(), 1, &bind_info[first_bind_count - 1]);
m_errorMonitor->VerifyFound();
}
for (auto memory : session_memory) {
vk::FreeMemory(m_device->device(), memory, nullptr);
}
}
TEST_F(VkVideoLayerTest, CreateSessionParamsIncompatibleTemplate) {
TEST_DESCRIPTION("vkCreateVideoSessionParametersKHR - incompatible template");
ASSERT_NO_FATAL_FAILURE(Init());
VideoConfig config = GetConfigWithParams(GetConfigs());
if (!config) {
GTEST_SKIP() << "Test requires a video profile with session parameters";
}
VideoContext context1(DeviceObj(), config);
VideoContext context2(DeviceObj(), config);
VkVideoSessionParametersCreateInfoKHR create_info = *config.SessionParamsCreateInfo();
create_info.videoSessionParametersTemplate = context1.SessionParams();
create_info.videoSession = context2.Session();
VkVideoSessionParametersKHR params;
m_errorMonitor->SetDesiredFailureMsg(kErrorBit,
"VUID-VkVideoSessionParametersCreateInfoKHR-videoSessionParametersTemplate-04855");
context1.vk.CreateVideoSessionParametersKHR(m_device->device(), &create_info, nullptr, ¶ms);
m_errorMonitor->VerifyFound();
}
TEST_F(VkVideoLayerTest, CreateSessionParamsMissingCodecInfo) {
TEST_DESCRIPTION("vkCreateVideoSessionParametersKHR - missing codec-specific chained structure");
ASSERT_NO_FATAL_FAILURE(Init());
if (GetConfigDecodeH264()) {
VideoConfig config = GetConfigDecodeH264();
VideoContext context(DeviceObj(), config);
VkVideoSessionParametersKHR params;
VkVideoSessionParametersCreateInfoKHR create_info = *config.SessionParamsCreateInfo();
auto other_codec_info = LvlInitStruct<VkVideoDecodeH265SessionParametersCreateInfoKHR>();
other_codec_info.maxStdVPSCount = 1;
other_codec_info.maxStdSPSCount = 1;
other_codec_info.maxStdPPSCount = 1;
create_info.pNext = &other_codec_info;
create_info.videoSession = context.Session();
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07203");
context.vk.CreateVideoSessionParametersKHR(m_device->device(), &create_info, nullptr, ¶ms);
m_errorMonitor->VerifyFound();
}
if (GetConfigDecodeH265()) {
VideoConfig config = GetConfigDecodeH265();
VideoContext context(DeviceObj(), config);
VkVideoSessionParametersKHR params;
VkVideoSessionParametersCreateInfoKHR create_info = *config.SessionParamsCreateInfo();
auto other_codec_info = LvlInitStruct<VkVideoDecodeH264SessionParametersCreateInfoKHR>();
other_codec_info.maxStdSPSCount = 1;
other_codec_info.maxStdPPSCount = 1;
create_info.pNext = &other_codec_info;
create_info.videoSession = context.Session();
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07206");
context.vk.CreateVideoSessionParametersKHR(m_device->device(), &create_info, nullptr, ¶ms);
m_errorMonitor->VerifyFound();
}
}
TEST_F(VkVideoLayerTest, CreateSessionParamsH264ExceededCapacity) {
TEST_DESCRIPTION("vkCreateVideoSessionParametersKHR - H.264 parameter set capacity exceeded");
ASSERT_NO_FATAL_FAILURE(Init());
VideoConfig config = GetConfigDecodeH264();
if (!config) {
GTEST_SKIP() << "Test requires H.264 decode support";
}
VideoContext context(DeviceObj(), config);
auto h264_ci = LvlInitStruct<VkVideoDecodeH264SessionParametersCreateInfoKHR>();
auto h264_ai = LvlInitStruct<VkVideoDecodeH264SessionParametersAddInfoKHR>();
VkVideoSessionParametersKHR params, params2;
VkVideoSessionParametersCreateInfoKHR create_info = *config.SessionParamsCreateInfo();
create_info.pNext = &h264_ci;
create_info.videoSession = context.Session();
h264_ci.pParametersAddInfo = &h264_ai;
std::vector<StdVideoH264SequenceParameterSet> sps_list{CreateH264SPS(1), CreateH264SPS(2), CreateH264SPS(3)};
std::vector<StdVideoH264PictureParameterSet> pps_list{
CreateH264PPS(1, 1), CreateH264PPS(1, 4), CreateH264PPS(2, 1),
CreateH264PPS(2, 2), CreateH264PPS(3, 1), CreateH264PPS(3, 3),
};
h264_ai.stdSPSCount = (uint32_t)sps_list.size();
h264_ai.pStdSPSs = sps_list.data();
h264_ai.stdPPSCount = (uint32_t)pps_list.size();
h264_ai.pStdPPSs = pps_list.data();
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07204");
h264_ci.maxStdSPSCount = 2;
h264_ci.maxStdPPSCount = 8;
context.vk.CreateVideoSessionParametersKHR(m_device->device(), &create_info, nullptr, ¶ms);
m_errorMonitor->VerifyFound();
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07205");
h264_ci.maxStdSPSCount = 3;
h264_ci.maxStdPPSCount = 5;
context.vk.CreateVideoSessionParametersKHR(m_device->device(), &create_info, nullptr, ¶ms);
m_errorMonitor->VerifyFound();
h264_ci.maxStdSPSCount = 3;
h264_ci.maxStdPPSCount = 6;
ASSERT_VK_SUCCESS(context.vk.CreateVideoSessionParametersKHR(m_device->device(), &create_info, nullptr, ¶ms));
create_info.videoSessionParametersTemplate = params;
sps_list[1].seq_parameter_set_id = 4;
pps_list[1].seq_parameter_set_id = 4;
pps_list[5].seq_parameter_set_id = 4;
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07204");
h264_ci.maxStdSPSCount = 3;
h264_ci.maxStdPPSCount = 8;
context.vk.CreateVideoSessionParametersKHR(m_device->device(), &create_info, nullptr, ¶ms2);
m_errorMonitor->VerifyFound();
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07205");
h264_ci.maxStdSPSCount = 4;
h264_ci.maxStdPPSCount = 7;
context.vk.CreateVideoSessionParametersKHR(m_device->device(), &create_info, nullptr, ¶ms2);
m_errorMonitor->VerifyFound();
create_info.videoSessionParametersTemplate = params;
h264_ci.pParametersAddInfo = nullptr;
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07204");
h264_ci.maxStdSPSCount = 2;
h264_ci.maxStdPPSCount = 8;
context.vk.CreateVideoSessionParametersKHR(m_device->device(), &create_info, nullptr, ¶ms2);
m_errorMonitor->VerifyFound();
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07205");
h264_ci.maxStdSPSCount = 3;
h264_ci.maxStdPPSCount = 5;
context.vk.CreateVideoSessionParametersKHR(m_device->device(), &create_info, nullptr, ¶ms2);
m_errorMonitor->VerifyFound();
context.vk.DestroyVideoSessionParametersKHR(m_device->device(), params, nullptr);
}
TEST_F(VkVideoLayerTest, CreateSessionParamsH265ExceededCapacity) {
TEST_DESCRIPTION("vkCreateVideoSessionParametersKHR - H.265 parameter set capacity exceeded");
ASSERT_NO_FATAL_FAILURE(Init());
VideoConfig config = GetConfigDecodeH265();
if (!config) {
GTEST_SKIP() << "Test requires H.265 decode support";
}
VideoContext context(DeviceObj(), config);
auto h265_ci = LvlInitStruct<VkVideoDecodeH265SessionParametersCreateInfoKHR>();
auto h265_ai = LvlInitStruct<VkVideoDecodeH265SessionParametersAddInfoKHR>();
VkVideoSessionParametersKHR params, params2;
VkVideoSessionParametersCreateInfoKHR create_info = *config.SessionParamsCreateInfo();
create_info.pNext = &h265_ci;
create_info.videoSession = context.Session();
h265_ci.pParametersAddInfo = &h265_ai;
std::vector<StdVideoH265VideoParameterSet> vps_list{
CreateH265VPS(1),
CreateH265VPS(2),
};
std::vector<StdVideoH265SequenceParameterSet> sps_list{
CreateH265SPS(1, 1),
CreateH265SPS(1, 2),
CreateH265SPS(2, 1),
CreateH265SPS(2, 3),
};
std::vector<StdVideoH265PictureParameterSet> pps_list{
CreateH265PPS(1, 1, 1), CreateH265PPS(1, 1, 2), CreateH265PPS(1, 2, 1), CreateH265PPS(2, 1, 3),
CreateH265PPS(2, 3, 1), CreateH265PPS(2, 3, 2), CreateH265PPS(2, 3, 3),
};
h265_ai.stdVPSCount = (uint32_t)vps_list.size();
h265_ai.pStdVPSs = vps_list.data();
h265_ai.stdSPSCount = (uint32_t)sps_list.size();
h265_ai.pStdSPSs = sps_list.data();
h265_ai.stdPPSCount = (uint32_t)pps_list.size();
h265_ai.pStdPPSs = pps_list.data();
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07207");
h265_ci.maxStdVPSCount = 1;
h265_ci.maxStdSPSCount = 4;
h265_ci.maxStdPPSCount = 8;
context.vk.CreateVideoSessionParametersKHR(m_device->device(), &create_info, nullptr, ¶ms);
m_errorMonitor->VerifyFound();
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07208");
h265_ci.maxStdVPSCount = 2;
h265_ci.maxStdSPSCount = 3;
h265_ci.maxStdPPSCount = 9;
context.vk.CreateVideoSessionParametersKHR(m_device->device(), &create_info, nullptr, ¶ms);
m_errorMonitor->VerifyFound();
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07209");
h265_ci.maxStdVPSCount = 3;
h265_ci.maxStdSPSCount = 5;
h265_ci.maxStdPPSCount = 5;
context.vk.CreateVideoSessionParametersKHR(m_device->device(), &create_info, nullptr, ¶ms);
m_errorMonitor->VerifyFound();
h265_ci.maxStdVPSCount = 2;
h265_ci.maxStdSPSCount = 4;
h265_ci.maxStdPPSCount = 7;
ASSERT_VK_SUCCESS(context.vk.CreateVideoSessionParametersKHR(m_device->device(), &create_info, nullptr, ¶ms));
create_info.videoSessionParametersTemplate = params;
vps_list[1].vps_video_parameter_set_id = 3;
sps_list[1].sps_video_parameter_set_id = 3;
pps_list[1].sps_video_parameter_set_id = 3;
pps_list[5].sps_video_parameter_set_id = 3;
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07207");
h265_ci.maxStdVPSCount = 2;
h265_ci.maxStdSPSCount = 5;
h265_ci.maxStdPPSCount = 10;
context.vk.CreateVideoSessionParametersKHR(m_device->device(), &create_info, nullptr, ¶ms2);
m_errorMonitor->VerifyFound();
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07208");
h265_ci.maxStdVPSCount = 3;
h265_ci.maxStdSPSCount = 4;
h265_ci.maxStdPPSCount = 9;
context.vk.CreateVideoSessionParametersKHR(m_device->device(), &create_info, nullptr, ¶ms2);
m_errorMonitor->VerifyFound();
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07209");
h265_ci.maxStdVPSCount = 3;
h265_ci.maxStdSPSCount = 5;
h265_ci.maxStdPPSCount = 8;
context.vk.CreateVideoSessionParametersKHR(m_device->device(), &create_info, nullptr, ¶ms2);
m_errorMonitor->VerifyFound();
create_info.videoSessionParametersTemplate = params;
h265_ci.pParametersAddInfo = nullptr;
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07207");
h265_ci.maxStdVPSCount = 1;
h265_ci.maxStdSPSCount = 4;
h265_ci.maxStdPPSCount = 7;
context.vk.CreateVideoSessionParametersKHR(m_device->device(), &create_info, nullptr, ¶ms2);
m_errorMonitor->VerifyFound();
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07208");
h265_ci.maxStdVPSCount = 2;
h265_ci.maxStdSPSCount = 3;
h265_ci.maxStdPPSCount = 7;
context.vk.CreateVideoSessionParametersKHR(m_device->device(), &create_info, nullptr, ¶ms2);
m_errorMonitor->VerifyFound();
m_errorMonitor->SetDesiredFailureMsg(kErrorBit, "VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07209");
h265_ci.maxStdVPSCount = 2;
h265_ci.maxStdSPSCount = 4;
h265_ci.maxStdPPSCount = 6;
context.vk.CreateVideoSessionParametersKHR(m_device->device(), &create_info, nullptr, ¶ms2);
m_errorMonitor->VerifyFound();
context.vk.DestroyVideoSessionParametersKHR(m_device->device(), params, nullptr);
}
TEST_F(VkVideoLayerTest, H264ParametersAddInfoUniqueness) {
TEST_DESCRIPTION("VkVideoDecodeH264SessionParametersAddInfoKHR - parameter set uniqueness");
ASSERT_NO_FATAL_FAILURE(Init());
VideoConfig config = GetConfigDecodeH264();
if (!config) {
GTEST_SKIP() << "Test requires H.264 decode support";
}
VideoContext context(DeviceObj(), config);
auto h264_ci = LvlInitStruct<VkVideoDecodeH264SessionParametersCreateInfoKHR>();
auto h264_ai = LvlInitStruct<VkVideoDecodeH264SessionParametersAddInfoKHR>();
VkVideoSessionParametersKHR params;
VkVideoSessionParametersCreateInfoKHR create_info = *config.SessionParamsCreateInfo();
create_info.pNext = &h264_ci;
create_info.videoSession = context.Session();