1// Copyright 2018-2024 The Khronos Group Inc. 2// 3// SPDX-License-Identifier: CC-BY-4.0 4 5[[video-coding]] 6= Video Coding 7 8Vulkan implementations may: expose one or more queue families supporting 9video coding operations. 10These operations are performed by recording them into a command buffer 11within a <<video-coding-scope,video coding scope>>, and submitting them to 12queues with compatible video coding capabilities. 13 14The Vulkan video functionalities are designed to be made available through a 15set of APIs built on top of each other, consisting of: 16 17 * A core API providing common video coding functionalities, 18 * APIs providing codec-independent video decode and video encode related 19 functionalities, respectively, 20 * Additional codec-specific APIs built on top of those. 21 22This chapter details the fundamental components and operations of these. 23 24 25[[video-picture-resources]] 26== Video Picture Resources 27 28In the context of video coding, multidimensional arrays of image data that 29can: be used as the source or target of video coding operations are referred 30to as _video picture resources_. 31They may: store additional metadata that includes implementation-private 32information used during the execution of video coding operations, as 33discussed later. 34 35Video picture resources are backed by slink:VkImage objects. 36Individual subregions of slink:VkImageView objects created from such 37resources can: be used as 38ifdef::VK_KHR_video_decode_queue[] 39<<decode-output-picture,decode output pictures>>, 40endif::VK_KHR_video_decode_queue[] 41ifdef::VK_KHR_video_encode_queue[] 42<<encode-input-picture,encode input pictures>>, 43endif::VK_KHR_video_encode_queue[] 44<<reconstructed-picture,reconstructed pictures>>, and/or 45<<reference-picture, reference pictures>>. 46 47The parameters of a video picture resource are specified using a 48sname:VkVideoPictureResourceInfoKHR structure. 49 50[open,refpage='VkVideoPictureResourceInfoKHR',desc='Structure specifying the parameters of a video picture resource',type='structs'] 51-- 52The sname:VkVideoPictureResourceInfoKHR structure is defined as: 53 54include::{generated}/api/structs/VkVideoPictureResourceInfoKHR.adoc[] 55 56 * pname:sType is a elink:VkStructureType value identifying this structure. 57 * pname:pNext is `NULL` or a pointer to a structure extending this 58 structure. 59 * pname:codedOffset is the offset in texels of the image subregion to use. 60 * pname:codedExtent is the size in pixels of the coded image data. 61 * pname:baseArrayLayer is the array layer of the image view specified in 62 pname:imageViewBinding to use as the video picture resource. 63 * pname:imageViewBinding is an image view representing the video picture 64 resource. 65 66[[video-image-subresource-reference]] 67The image subresource referred to by such a structure is defined as the 68image array layer index specified in pname:baseArrayLayer relative to the 69image subresource range the image view specified in pname:imageViewBinding 70was created with. 71 72The meaning of the pname:codedOffset and pname:codedExtent depends on the 73command and context the video picture resource is used in, as well as on the 74used <<video-profiles,video profile>> and corresponding codec-specific 75semantics, as described later. 76 77[[video-picture-resource-uniqueness]] 78A video picture resource is uniquely defined by the image subresource 79referred to by an instance of this structure, together with the 80pname:codedOffset and pname:codedExtent members that identify the image 81subregion within the image subresource referenced corresponding to the video 82picture resource according to the particular codec-specific semantics. 83 84Accesses to image data within a video picture resource happen at the 85granularity indicated by 86slink:VkVideoCapabilitiesKHR::pname:pictureAccessGranularity, as returned by 87flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the used <<video-profiles, 88video profile>>. 89As a result, given an effective image subregion corresponding to a video 90picture resource, the actual image subregion accessed may: be larger than 91that as it may: include additional padding texels due to the picture access 92granularity. 93Any writes performed by video coding operations to such padding texels will 94result in undefined: texel values. 95 96[[video-picture-resource-matching]] 97Two video picture resources match if they refer to the same image 98subresource and they specify identical pname:codedOffset and 99pname:codedExtent values. 100 101.Valid Usage 102**** 103 * [[VUID-VkVideoPictureResourceInfoKHR-baseArrayLayer-07175]] 104 pname:baseArrayLayer must: be less than the 105 slink:VkImageViewCreateInfo::pname:subresourceRange.layerCount specified 106 when the image view pname:imageViewBinding was created 107**** 108 109include::{generated}/validity/structs/VkVideoPictureResourceInfoKHR.adoc[] 110-- 111 112 113[[dpb]] 114== Decoded Picture Buffer 115 116[[reconstructed-picture]] 117An integral part of video coding pipelines is the reconstruction of pictures 118from a compressed video bitstream. 119A _reconstructed picture_ is a <<video-picture-resources,video picture 120resource>> resulting from this process. 121 122[[reference-picture]] 123Such reconstructed pictures can: be used as _reference pictures_ in 124subsequent video coding operations to provide predictions of the values of 125samples of subsequently decoded or encoded pictures. 126The correct use of such reconstructed pictures as reference pictures is 127driven by the video compression standard, the implementation, and the 128application-specific use cases. 129 130[[active-reference-pictures]] 131The list of reference pictures used to provide such predictions within a 132single video coding operation is referred to as the list of _active 133reference pictures_. 134 135The _decoded picture buffer (DPB)_ is an indexed data structure that 136maintains the set of reference pictures available to be used in video coding 137operations. 138[[dpb-slot]] Individual indexed entries of the DPB are referred to as the 139_decoded picture buffer (DPB) slots_. 140[[dpb-capacity]] The range of valid DPB slot indices is between zero and 141`N-1`, where `N` is the capacity of the DPB. 142Each DPB slot can: refer to a reference picture containing a _video frame_ 143ifdef::VK_KHR_video_decode_h264[] 144or can: refer to up to two reference pictures containing the top and/or 145bottom _fields_ that, when both present, together represent a full _video 146frame_ 147endif::VK_KHR_video_decode_h264[] 148. 149 150[[dpb-state-and-backing-store]] 151In Vulkan, the state and the backing store of the DPB is separated as 152follows: 153 154 * The state of individual DPB slots is maintained by <<video-session,video 155 session>> objects. 156 * The backing store of DPB slots is provided by subregions of 157 slink:VkImage objects used as <<video-picture-resources,video picture 158 resources>>. 159 160In addition, the implementation may: also maintain opaque metadata 161associated with DPB slots, including: 162 163 * [[reference-metadata]] _Reference picture metadata_ corresponding to the 164 video picture resource associated with the DPB slot. 165 166Such metadata may: be stored by the implementation as part of the DPB slot 167state maintained by the video session, or as part of the video picture 168resource backing the DPB slot. 169 170Any metadata stored in the video picture resources backing DPB slots are 171independent of the video session used to store it, hence such video picture 172resources can: be shared with other video sessions. 173Correspondingly, any metadata that is dependent on the video session will 174always be stored as part of the DPB slot state maintained by that video 175session. 176 177The responsibility of managing the DPB is split between the application and 178the implementation as follows: 179 180 * The application maintains the association between <<dpb-slot,DPB slot>> 181 indices and corresponding <<video-picture-resources,video picture 182 resources>>. 183 * The implementation maintains global and per-slot opaque 184 <<reference-metadata,reference picture metadata>>. 185 186In addition, the application is also responsible for managing the mapping 187between the codec-specific picture IDs and DPB slots, and any other 188codec-specific states unless otherwise specified. 189 190[[dpb-slot-states]] 191=== DPB Slot States 192 193At a given time, each DPB slot is either in _active_ or _inactive_ state. 194Initially, all DPB slots managed by a <<video-session,video session>> are in 195_inactive_ state. 196 197A DPB slot can: be _activated_ by using it as the target of picture 198reconstruction in a video coding operation with the reconstructed picture 199requested to be set up as a reference picture, according to the 200codec-specific semantics, changing its state to _active_ and associating it 201with a _picture reference_ to the <<reconstructed-picture,reconstructed 202pictures>>. 203 204Some video coding standards allow multiple picture references to be 205associated with a single DPB slot. 206In this case the state of the individual picture references can: be 207independently updated. 208 209ifdef::VK_KHR_video_decode_h264[] 210[NOTE] 211.Note 212==== 213As an example, H.264 decoding allows associating a separate top field and 214bottom field picture with the same DPB slot. 215==== 216endif::VK_KHR_video_decode_h264[] 217 218As part of reference picture setup, the implementation may: also generate 219<<reference-metadata,reference picture metadata>>. 220Such reference picture metadata is specific to each picture reference 221associated with the DPB slot. 222 223If such a video coding operation completes successfully, the activated DPB 224slot will have a _valid picture reference_ and the <<reconstructed-picture, 225reconstructed picture>> is associated with the DPB slot. 226ifdef::VK_KHR_video_decode_h264[] 227This is true even if the DPB slot is used as the target of a picture 228reconstruction that only sets up a top field or bottom field reference 229picture and thus does not yet refer to a complete frame. 230endif::VK_KHR_video_decode_h264[] 231However, if any data provided as input to such a video coding operation is 232not compliant to the video compression standard used, that video coding 233operation may: complete unsuccessfully, in which case the activated DPB slot 234will have an _invalid picture reference_. 235ifdef::VK_KHR_video_decode_h264[] 236This is true even if the DPB slot previously had a valid picture reference 237to a top field or bottom field reference picture, but the reconstruction of 238the other field corresponding to the DPB slot failed. 239endif::VK_KHR_video_decode_h264[] 240 241The application can: use <<queries,queries>> to get feedback about the 242outcome of video coding operations and use the resulting 243elink:VkQueryResultStatusKHR value to determine whether the video coding 244operation completed successfully (result status is positive) or 245unsuccessfully (result status is negative). 246 247Using a <<reference-picture,reference picture>> associated with a DPB slot 248that has an _invalid picture reference_ as an <<active-reference-pictures, 249active reference picture>> in subsequent video coding operations is legal, 250however, the contents of the outputs of such operations are undefined:, and 251any DPB slots activated by such video coding operations will also have an 252_invalid picture reference_. 253This is true even if such video coding operations may: otherwise complete 254successfully. 255 256A DPB slot can: also be _deactivated_ by the application, changing its state 257to _inactive_ and invalidating any picture references and 258<<reference-metadata,reference picture metadata>> associated with the DPB 259slot. 260 261If an already active DPB slot is used as the target of picture 262reconstruction in a video coding operation, but the decoded picture is not 263requested to be set up as a reference picture, according to the 264codec-specific semantics, no reference picture setup happens and the 265corresponding picture reference and <<reference-metadata,reference picture 266metadata>> is invalidated within the DPB slot. 267If the DPB slot no longer has any associated picture references after such 268an operation, the DPB slot is implicitly deactivated. 269 270ifdef::VK_KHR_video_decode_h264[] 271If an already active DPB slot is used as the target of picture 272reconstruction when decoding a field picture that is not marked as 273reference, then the behavior is as follows: 274 275 * If the DPB slot is currently associated with a frame, then the DPB slot 276 is deactivated. 277 * If the DPB slot is not currently associated with a top field picture and 278 the decoded picture is a top field picture, or if the DPB slot is not 279 currently associated with a bottom field picture and the decoded picture 280 is a bottom field picture, then the other field picture association of 281 the DPB slot, if any, is not disturbed. 282 * If the DPB slot is currently associated with a top field picture and the 283 decoded picture is a top field picture, or if the DPB slot is currently 284 associated with a bottom field picture and the decoded picture is a 285 bottom field picture, then that picture association is invalidated, 286 without disturbing the other field picture association, if any. 287 If the DPB slot no longer has any associated picture references after 288 such an operation, the DPB slot is implicitly deactivated. 289endif::VK_KHR_video_decode_h264[] 290 291A DPB slot can: be activated with a new frame even if it is already active. 292In this case all previous associations of the DPB slots with 293<<reference-picture,reference pictures>> are replaced with an association 294with the <<reconstructed-picture,reconstructed picture>> used to activate 295it. 296 297ifdef::VK_KHR_video_decode_h264[] 298If an already active DPB slot is activated with a reconstructed field 299picture, then the behavior is as follows: 300 301 * If the DPB slot is currently associated with a frame, then that 302 association is replaced with an association with the reconstructed field 303 picture used to activate it. 304 * If the DPB slot is not currently associated with a top field picture and 305 the DPB slot is activated with a top field picture, or if the DPB slot 306 is not currently associated with a bottom field picture and the DPB slot 307 is activated with a bottom field picture, then the DPB slot is 308 associated with the reconstructed field picture used to activate it, 309 without disturbing the other field picture association, if any. 310 * If the DPB slot is currently associated with a top field picture and the 311 DPB slot is activated with a new top field picture, or if the DPB slot 312 is currently associated with a bottom field picture and the DPB slot is 313 activated with a new bottom field picture, then that association is 314 replaced with an association with the reconstructed field picture used 315 to activate it, without disturbing the other field picture association, 316 if any. 317endif::VK_KHR_video_decode_h264[] 318 319 320[[video-profiles]] 321== Video Profiles 322 323[open,refpage='VkVideoProfileInfoKHR',desc='Structure specifying a video profile',type='structs'] 324-- 325The sname:VkVideoProfileInfoKHR structure is defined as follows: 326 327include::{generated}/api/structs/VkVideoProfileInfoKHR.adoc[] 328 329 * pname:sType is a elink:VkStructureType value identifying this structure. 330 * pname:pNext is `NULL` or a pointer to a structure extending this 331 structure. 332 * pname:videoCodecOperation is a elink:VkVideoCodecOperationFlagBitsKHR 333 value specifying a video codec operation. 334 * pname:chromaSubsampling is a bitmask of 335 elink:VkVideoChromaSubsamplingFlagBitsKHR specifying video chroma 336 subsampling information. 337 * pname:lumaBitDepth is a bitmask of 338 elink:VkVideoComponentBitDepthFlagBitsKHR specifying video luma bit 339 depth information. 340 * pname:chromaBitDepth is a bitmask of 341 elink:VkVideoComponentBitDepthFlagBitsKHR specifying video chroma bit 342 depth information. 343 344Video profiles are provided as input to video capability queries such as 345flink:vkGetPhysicalDeviceVideoCapabilitiesKHR or 346flink:vkGetPhysicalDeviceVideoFormatPropertiesKHR, as well as when creating 347resources to be used by video coding operations such as images, buffers, 348query pools, and video sessions. 349 350The full description of a video profile is specified by an instance of this 351structure, and the codec-specific and auxiliary structures provided in its 352pname:pNext chain. 353 354[[video-profile-error-codes]] 355When this structure is specified as an input parameter to 356flink:vkGetPhysicalDeviceVideoCapabilitiesKHR, or through the 357pname:pProfiles member of an slink:VkVideoProfileListInfoKHR structure in 358the pname:pNext chain of the input parameter of a query command such as 359flink:vkGetPhysicalDeviceVideoFormatPropertiesKHR or 360flink:vkGetPhysicalDeviceImageFormatProperties2, the following error codes 361indicate specific causes of the failure of the query operation: 362 363 * ename:VK_ERROR_VIDEO_PICTURE_LAYOUT_NOT_SUPPORTED_KHR indicates that the 364 requested video picture layout 365ifdef::VK_KHR_video_decode_h264[] 366 (e.g. through the pname:pictureLayout member of a 367 slink:VkVideoDecodeH264ProfileInfoKHR structure included in the 368 pname:pNext chain of sname:VkVideoProfileInfoKHR) 369endif::VK_KHR_video_decode_h264[] 370 is not supported. 371 * ename:VK_ERROR_VIDEO_PROFILE_OPERATION_NOT_SUPPORTED_KHR indicates that 372 a video profile operation specified by pname:videoCodecOperation is not 373 supported. 374 * ename:VK_ERROR_VIDEO_PROFILE_FORMAT_NOT_SUPPORTED_KHR indicates that 375 video format parameters specified by pname:chromaSubsampling, 376 pname:lumaBitDepth, or pname:chromaBitDepth are not supported. 377 * ename:VK_ERROR_VIDEO_PROFILE_CODEC_NOT_SUPPORTED_KHR indicates that the 378 codec-specific parameters corresponding to the video codec operation are 379 not supported. 380 381.Valid Usage 382**** 383 * [[VUID-VkVideoProfileInfoKHR-chromaSubsampling-07013]] 384 pname:chromaSubsampling must: have a single bit set 385 * [[VUID-VkVideoProfileInfoKHR-lumaBitDepth-07014]] 386 pname:lumaBitDepth must: have a single bit set 387 * [[VUID-VkVideoProfileInfoKHR-chromaSubsampling-07015]] 388 If pname:chromaSubsampling is not 389 ename:VK_VIDEO_CHROMA_SUBSAMPLING_MONOCHROME_BIT_KHR, then 390 pname:chromaBitDepth must: have a single bit set 391ifdef::VK_KHR_video_decode_h264[] 392 * [[VUID-VkVideoProfileInfoKHR-videoCodecOperation-07179]] 393 If pname:videoCodecOperation is 394 ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then the pname:pNext 395 chain must: include a slink:VkVideoDecodeH264ProfileInfoKHR structure 396endif::VK_KHR_video_decode_h264[] 397ifdef::VK_KHR_video_decode_h265[] 398 * [[VUID-VkVideoProfileInfoKHR-videoCodecOperation-07180]] 399 If pname:videoCodecOperation is 400 ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then the pname:pNext 401 chain must: include a slink:VkVideoDecodeH265ProfileInfoKHR structure 402endif::VK_KHR_video_decode_h265[] 403ifdef::VK_KHR_video_encode_h264[] 404 * [[VUID-VkVideoProfileInfoKHR-videoCodecOperation-07181]] 405 If pname:videoCodecOperation is 406 ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR, then the pname:pNext 407 chain must: include a slink:VkVideoEncodeH264ProfileInfoKHR structure 408endif::VK_KHR_video_encode_h264[] 409ifdef::VK_KHR_video_encode_h265[] 410 * [[VUID-VkVideoProfileInfoKHR-videoCodecOperation-07182]] 411 If pname:videoCodecOperation is 412 ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, then the pname:pNext 413 chain must: include a slink:VkVideoEncodeH265ProfileInfoKHR structure 414endif::VK_KHR_video_encode_h265[] 415**** 416 417include::{generated}/validity/structs/VkVideoProfileInfoKHR.adoc[] 418-- 419 420[open,refpage='VkVideoCodecOperationFlagBitsKHR',desc='Video codec operation bits',type='enums'] 421-- 422Possible values of slink:VkVideoProfileInfoKHR::pname:videoCodecOperation, 423specifying the type of video coding operation and video compression standard 424used by a video profile, are: 425 426include::{generated}/api/enums/VkVideoCodecOperationFlagBitsKHR.adoc[] 427 428 * ename:VK_VIDEO_CODEC_OPERATION_NONE_KHR indicates no support for any 429 video codec operations. 430ifdef::VK_KHR_video_decode_h264[] 431 * ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR specifies support for 432 <<decode-h264,H.264 decode operations>>. 433endif::VK_KHR_video_decode_h264[] 434ifdef::VK_KHR_video_decode_h265[] 435 * ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR specifies support for 436 <<decode-h265,H.265 decode operations>>. 437endif::VK_KHR_video_decode_h265[] 438ifdef::VK_KHR_video_encode_h264[] 439 * ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR specifies support for 440 <<encode-h264,H.264 encode operations>>. 441endif::VK_KHR_video_encode_h264[] 442ifdef::VK_KHR_video_encode_h265[] 443 * ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR specifies support for 444 <<encode-h265,H.265 encode operations>>. 445endif::VK_KHR_video_encode_h265[] 446-- 447 448[open,refpage='VkVideoCodecOperationFlagsKHR',desc='Bitmask of VkVideoCodecOperationFlagBitsKHR',type='flags'] 449-- 450include::{generated}/api/flags/VkVideoCodecOperationFlagsKHR.adoc[] 451 452tname:VkVideoCodecOperationFlagsKHR is a bitmask type for setting a mask of 453zero or more elink:VkVideoCodecOperationFlagBitsKHR. 454-- 455 456[open,refpage='VkVideoChromaSubsamplingFlagBitsKHR',desc='Video format chroma subsampling bits',type='enums'] 457-- 458The video format chroma subsampling is defined with the following enums: 459 460include::{generated}/api/enums/VkVideoChromaSubsamplingFlagBitsKHR.adoc[] 461 462 * ename:VK_VIDEO_CHROMA_SUBSAMPLING_MONOCHROME_BIT_KHR specifies that the 463 format is monochrome. 464 * ename:VK_VIDEO_CHROMA_SUBSAMPLING_420_BIT_KHR specified that the format 465 is 4:2:0 chroma subsampled, i.e. the two chroma components are sampled 466 horizontally and vertically at half the sample rate of the luma 467 component. 468 * ename:VK_VIDEO_CHROMA_SUBSAMPLING_422_BIT_KHR - the format is 4:2:2 469 chroma subsampled, i.e. the two chroma components are sampled 470 horizontally at half the sample rate of luma component. 471 * ename:VK_VIDEO_CHROMA_SUBSAMPLING_444_BIT_KHR - the format is 4:4:4 472 chroma sampled, i.e. all three components of the {YCbCr} format are 473 sampled at the same rate, thus there is no chroma subsampling. 474-- 475 476Chroma subsampling is described in more detail in the 477<<textures-chroma-reconstruction,Chroma Reconstruction>> section. 478 479[open,refpage='VkVideoChromaSubsamplingFlagsKHR',desc='Bitmask of VkVideoChromaSubsamplingFlagBitsKHR',type='flags'] 480-- 481include::{generated}/api/flags/VkVideoChromaSubsamplingFlagsKHR.adoc[] 482 483tname:VkVideoChromaSubsamplingFlagsKHR is a bitmask type for setting a mask 484of zero or more elink:VkVideoChromaSubsamplingFlagBitsKHR. 485-- 486 487[open,refpage='VkVideoComponentBitDepthFlagBitsKHR',desc='Video format component bit depth',type='enums'] 488-- 489Possible values for the video format component bit depth are: 490 491include::{generated}/api/enums/VkVideoComponentBitDepthFlagBitsKHR.adoc[] 492 493 * ename:VK_VIDEO_COMPONENT_BIT_DEPTH_8_BIT_KHR specifies a component bit 494 depth of 8 bits. 495 * ename:VK_VIDEO_COMPONENT_BIT_DEPTH_10_BIT_KHR specifies a component bit 496 depth of 10 bits. 497 * ename:VK_VIDEO_COMPONENT_BIT_DEPTH_12_BIT_KHR specifies a component bit 498 depth of 12 bits. 499-- 500 501[open,refpage='VkVideoComponentBitDepthFlagsKHR',desc='Bitmask of VkVideoComponentBitDepthFlagBitsKHR',type='flags'] 502-- 503include::{generated}/api/flags/VkVideoComponentBitDepthFlagsKHR.adoc[] 504 505tname:VkVideoComponentBitDepthFlagsKHR is a bitmask type for setting a mask 506of zero or more elink:VkVideoComponentBitDepthFlagBitsKHR. 507-- 508 509ifdef::VK_KHR_video_decode_queue[] 510[open,refpage='VkVideoDecodeUsageInfoKHR',desc='Structure specifying video decode usage information',type='structs'] 511-- 512Additional information about the video decode use case can: be provided by 513adding a sname:VkVideoDecodeUsageInfoKHR structure to the pname:pNext chain 514of slink:VkVideoProfileInfoKHR. 515 516The sname:VkVideoDecodeUsageInfoKHR structure is defined as: 517 518include::{generated}/api/structs/VkVideoDecodeUsageInfoKHR.adoc[] 519 520 * pname:sType is a elink:VkStructureType value identifying this structure. 521 * pname:pNext is `NULL` or a pointer to a structure extending this 522 structure. 523 * pname:videoUsageHints is a bitmask of 524 elink:VkVideoDecodeUsageFlagBitsKHR specifying hints about the intended 525 use of the video decode profile. 526 527include::{generated}/validity/structs/VkVideoDecodeUsageInfoKHR.adoc[] 528-- 529 530[open,refpage='VkVideoDecodeUsageFlagBitsKHR',desc='Video decode usage flags',type='enums'] 531-- 532The following bits can: be specified in 533slink:VkVideoDecodeUsageInfoKHR::pname:videoUsageHints as a hint about the 534video decode use case: 535 536include::{generated}/api/enums/VkVideoDecodeUsageFlagBitsKHR.adoc[] 537 538 * ename:VK_VIDEO_DECODE_USAGE_TRANSCODING_BIT_KHR specifies that video 539 decoding is intended to be used in conjunction with video encoding to 540 transcode a video bitstream with the same and/or different codecs. 541 * ename:VK_VIDEO_DECODE_USAGE_OFFLINE_BIT_KHR specifies that video 542 decoding is intended to be used to consume a local video bitstream. 543 * ename:VK_VIDEO_DECODE_USAGE_STREAMING_BIT_KHR specifies that video 544 decoding is intended to be used to consume a video bitstream received as 545 a continuous flow over network. 546 547[NOTE] 548.Note 549==== 550There are no restrictions on the combination of bits that can: be specified 551by the application. 552However, applications should: use reasonable combinations in order for the 553implementation to be able to select the most appropriate mode of operation 554for the particular use case. 555==== 556-- 557 558[open,refpage='VkVideoDecodeUsageFlagsKHR',desc='Bitmask specifying the video decode usage flags',type='flags'] 559-- 560include::{generated}/api/flags/VkVideoDecodeUsageFlagsKHR.adoc[] 561 562tname:VkVideoDecodeUsageFlagsKHR is a bitmask type for setting a mask of 563zero or more elink:VkVideoDecodeUsageFlagBitsKHR. 564-- 565endif::VK_KHR_video_decode_queue[] 566 567ifdef::VK_KHR_video_encode_queue[] 568[open,refpage='VkVideoEncodeUsageInfoKHR',desc='Structure specifying video encode usage information',type='structs'] 569-- 570Additional information about the video encode use case can: be provided by 571adding a sname:VkVideoEncodeUsageInfoKHR structure to the pname:pNext chain 572of slink:VkVideoProfileInfoKHR. 573 574The sname:VkVideoEncodeUsageInfoKHR structure is defined as: 575 576include::{generated}/api/structs/VkVideoEncodeUsageInfoKHR.adoc[] 577 578 * pname:sType is a elink:VkStructureType value identifying this structure. 579 * pname:pNext is `NULL` or a pointer to a structure extending this 580 structure. 581 * pname:videoUsageHints is a bitmask of 582 elink:VkVideoEncodeUsageFlagBitsKHR specifying hints about the intended 583 use of the video encode profile. 584 * pname:videoContentHints is a bitmask of 585 elink:VkVideoEncodeContentFlagBitsKHR specifying hints about the content 586 to be encoded using the video encode profile. 587 * pname:tuningMode is a elink:VkVideoEncodeTuningModeKHR value specifying 588 the tuning mode to use when encoding with the video profile. 589 590include::{generated}/validity/structs/VkVideoEncodeUsageInfoKHR.adoc[] 591-- 592 593[open,refpage='VkVideoEncodeUsageFlagBitsKHR',desc='Video encode usage flags',type='enums'] 594-- 595The following bits can: be specified in 596slink:VkVideoEncodeUsageInfoKHR::pname:videoUsageHints as a hint about the 597video encode use case: 598 599include::{generated}/api/enums/VkVideoEncodeUsageFlagBitsKHR.adoc[] 600 601 * ename:VK_VIDEO_ENCODE_USAGE_TRANSCODING_BIT_KHR specifies that video 602 encoding is intended to be used in conjunction with video decoding to 603 transcode a video bitstream with the same and/or different codecs. 604 * ename:VK_VIDEO_ENCODE_USAGE_STREAMING_BIT_KHR specifies that video 605 encoding is intended to be used to produce a video bitstream that is 606 expected to be sent as a continuous flow over network. 607 * ename:VK_VIDEO_ENCODE_USAGE_RECORDING_BIT_KHR specifies that video 608 encoding is intended to be used for real-time recording for offline 609 consumption. 610 * ename:VK_VIDEO_ENCODE_USAGE_CONFERENCING_BIT_KHR specifies that video 611 encoding is intended to be used in a video conferencing scenario. 612 613[NOTE] 614.Note 615==== 616There are no restrictions on the combination of bits that can: be specified 617by the application. 618However, applications should: use reasonable combinations in order for the 619implementation to be able to select the most appropriate mode of operation 620for the particular use case. 621==== 622-- 623 624[open,refpage='VkVideoEncodeUsageFlagsKHR',desc='Bitmask specifying the video encode usage flags',type='flags'] 625-- 626include::{generated}/api/flags/VkVideoEncodeUsageFlagsKHR.adoc[] 627 628tname:VkVideoEncodeUsageFlagsKHR is a bitmask type for setting a mask of 629zero or more elink:VkVideoEncodeUsageFlagBitsKHR. 630-- 631 632[open,refpage='VkVideoEncodeContentFlagBitsKHR',desc='Video encode content flags',type='enums'] 633-- 634The following bits can: be specified in 635slink:VkVideoEncodeUsageInfoKHR::pname:videoContentHints as a hint about the 636encoded video content: 637 638include::{generated}/api/enums/VkVideoEncodeContentFlagBitsKHR.adoc[] 639 640 * ename:VK_VIDEO_ENCODE_CONTENT_CAMERA_BIT_KHR specifies that video 641 encoding is intended to be used to encode camera content. 642 * ename:VK_VIDEO_ENCODE_CONTENT_DESKTOP_BIT_KHR specifies that video 643 encoding is intended to be used to encode desktop content. 644 * ename:VK_VIDEO_ENCODE_CONTENT_RENDERED_BIT_KHR specified that video 645 encoding is intended to be used to encode rendered (e.g. game) content. 646 647[NOTE] 648.Note 649==== 650There are no restrictions on the combination of bits that can: be specified 651by the application. 652However, applications should: use reasonable combinations in order for the 653implementation to be able to select the most appropriate mode of operation 654for the particular content type. 655==== 656-- 657 658[open,refpage='VkVideoEncodeContentFlagsKHR',desc='Bitmask specifying the video encode content flags',type='flags'] 659-- 660include::{generated}/api/flags/VkVideoEncodeContentFlagsKHR.adoc[] 661 662tname:VkVideoEncodeContentFlagsKHR is a bitmask type for setting a mask of 663zero or more elink:VkVideoEncodeContentFlagBitsKHR. 664-- 665 666[open,refpage='VkVideoEncodeTuningModeKHR',desc='Video encode tuning mode',type='enums'] 667-- 668Possible video encode tuning mode values are as follows: 669 670include::{generated}/api/enums/VkVideoEncodeTuningModeKHR.adoc[] 671 672 * ename:VK_VIDEO_ENCODE_TUNING_MODE_DEFAULT_KHR specifies the default 673 tuning mode. 674 * ename:VK_VIDEO_ENCODE_TUNING_MODE_HIGH_QUALITY_KHR specifies that video 675 encoding is tuned for high quality. 676 When using this tuning mode, the implementation may: compromise the 677 latency of video encoding operations to improve quality. 678 * ename:VK_VIDEO_ENCODE_TUNING_MODE_LOW_LATENCY_KHR specifies that video 679 encoding is tuned for low latency. 680 When using this tuning mode, the implementation may: compromise quality 681 to increase the performance and lower the latency of video encode 682 operations. 683 * ename:VK_VIDEO_ENCODE_TUNING_MODE_ULTRA_LOW_LATENCY_KHR specifies that 684 video encoding is tuned for ultra-low latency. 685 When using this tuning mode, the implementation may: compromise quality 686 to maximize the performance and minimize the latency of video encoding 687 operations. 688 * ename:VK_VIDEO_ENCODE_TUNING_MODE_LOSSLESS_KHR specifies that video 689 encoding is tuned for lossless encoding. 690 When using this tuning mode, video encode operations produce lossless 691 output. 692 693-- 694endif::VK_KHR_video_encode_queue[] 695 696[open,refpage='VkVideoProfileListInfoKHR',desc='Structure specifying one or more video profiles used in conjunction',type='structs'] 697-- 698The sname:VkVideoProfileListInfoKHR structure is defined as: 699 700include::{generated}/api/structs/VkVideoProfileListInfoKHR.adoc[] 701 702 * pname:sType is a elink:VkStructureType value identifying this structure. 703 * pname:pNext is `NULL` or a pointer to a structure extending this 704 structure. 705 * pname:profileCount is the number of elements in the pname:pProfiles 706 array. 707 * pname:pProfiles is a pointer to an array of slink:VkVideoProfileInfoKHR 708 structures. 709 710[NOTE] 711.Note 712==== 713Video transcoding is an example of a use case that necessitates the 714specification of multiple profiles in various contexts. 715==== 716 717When the application provides a video decode profile and one or more video 718encode profiles in the profile list, the implementation ensures that any 719capabilitities returned or resources created are suitable for the video 720transcoding use cases without the need for manual data transformations. 721 722.Valid Usage 723**** 724 * [[VUID-VkVideoProfileListInfoKHR-pProfiles-06813]] 725 pname:pProfiles must: not contain more than one element whose 726 pname:videoCodecOperation member specifies a decode operation 727**** 728 729include::{generated}/validity/structs/VkVideoProfileListInfoKHR.adoc[] 730-- 731 732 733[[video-capabilities]] 734== Video Capabilities 735 736 737[[video-coding-capabilities]] 738=== Video Coding Capabilities 739 740[open,refpage='vkGetPhysicalDeviceVideoCapabilitiesKHR',desc='Query video coding capabilities',type='protos'] 741-- 742To query video coding capabilities for a specific video profile, call: 743 744include::{generated}/api/protos/vkGetPhysicalDeviceVideoCapabilitiesKHR.adoc[] 745 746 * pname:physicalDevice is the physical device from which to query the 747 video decode or encode capabilities. 748 * pname:pVideoProfile is a pointer to a slink:VkVideoProfileInfoKHR 749 structure. 750 * pname:pCapabilities is a pointer to a slink:VkVideoCapabilitiesKHR 751 structure in which the capabilities are returned. 752 753[[video-profile-support]] 754If the <<video-profiles,video profile>> described by pname:pVideoProfile is 755supported by the implementation, then this command returns ename:VK_SUCCESS 756and pname:pCapabilities is filled with the capabilities supported with the 757specified video profile. 758Otherwise, one of the <<video-profile-error-codes, video-profile-specific 759error codes>> are returned. 760 761.Valid Usage 762**** 763ifdef::VK_KHR_video_decode_queue[] 764 * [[VUID-vkGetPhysicalDeviceVideoCapabilitiesKHR-pVideoProfile-07183]] 765 If pname:pVideoProfile->videoCodecOperation specifies a decode 766 operation, then the pname:pNext chain of pname:pCapabilities must: 767 include a slink:VkVideoDecodeCapabilitiesKHR structure 768endif::VK_KHR_video_decode_queue[] 769ifdef::VK_KHR_video_decode_h264[] 770 * [[VUID-vkGetPhysicalDeviceVideoCapabilitiesKHR-pVideoProfile-07184]] 771 If pname:pVideoProfile->videoCodecOperation is 772 ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then the pname:pNext 773 chain of pname:pCapabilities must: include a 774 slink:VkVideoDecodeH264CapabilitiesKHR structure 775endif::VK_KHR_video_decode_h264[] 776ifdef::VK_KHR_video_decode_h265[] 777 * [[VUID-vkGetPhysicalDeviceVideoCapabilitiesKHR-pVideoProfile-07185]] 778 If pname:pVideoProfile->videoCodecOperation is 779 ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then the pname:pNext 780 chain of pname:pCapabilities must: include a 781 slink:VkVideoDecodeH265CapabilitiesKHR structure 782endif::VK_KHR_video_decode_h265[] 783ifdef::VK_KHR_video_encode_queue[] 784 * [[VUID-vkGetPhysicalDeviceVideoCapabilitiesKHR-pVideoProfile-07186]] 785 If pname:pVideoProfile->videoCodecOperation specifies an encode 786 operation, then the pname:pNext chain of pname:pCapabilities must: 787 include a slink:VkVideoEncodeCapabilitiesKHR structure 788endif::VK_KHR_video_encode_queue[] 789ifdef::VK_KHR_video_encode_h264[] 790 * [[VUID-vkGetPhysicalDeviceVideoCapabilitiesKHR-pVideoProfile-07187]] 791 If pname:pVideoProfile->videoCodecOperation is 792 ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR, then the pname:pNext 793 chain of pname:pCapabilities must: include a 794 slink:VkVideoEncodeH264CapabilitiesKHR structure 795endif::VK_KHR_video_encode_h264[] 796ifdef::VK_KHR_video_encode_h265[] 797 * [[VUID-vkGetPhysicalDeviceVideoCapabilitiesKHR-pVideoProfile-07188]] 798 If pname:pVideoProfile->videoCodecOperation is 799 ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, then the pname:pNext 800 chain of pname:pCapabilities must: include a 801 slink:VkVideoEncodeH265CapabilitiesKHR structure 802endif::VK_KHR_video_encode_h265[] 803**** 804 805include::{generated}/validity/protos/vkGetPhysicalDeviceVideoCapabilitiesKHR.adoc[] 806-- 807 808 809[open,refpage='VkVideoCapabilitiesKHR',desc='Structure describing general video capabilities for a video profile',type='structs'] 810-- 811The sname:VkVideoCapabilitiesKHR structure is defined as: 812 813include::{generated}/api/structs/VkVideoCapabilitiesKHR.adoc[] 814 815 * pname:sType is a elink:VkStructureType value identifying this structure. 816 * pname:pNext is `NULL` or a pointer to a structure extending this 817 structure. 818 * pname:flags is a bitmask of elink:VkVideoCapabilityFlagBitsKHR 819 specifying capability flags. 820 * pname:minBitstreamBufferOffsetAlignment is the minimum alignment for 821 bitstream buffer offsets. 822 * pname:minBitstreamBufferSizeAlignment is the minimum alignment for 823 bitstream buffer range sizes. 824 * pname:pictureAccessGranularity is the granularity at which image access 825 to video picture resources happen. 826 * pname:minCodedExtent is the minimum width and height of the coded 827 frames. 828 * pname:maxCodedExtent is the maximum width and height of the coded 829 frames. 830 * pname:maxDpbSlots is the maximum number of <<dpb-slot,DPB slots>> 831 supported by a single video session. 832 * pname:maxActiveReferencePictures is the maximum number of 833 <<active-reference-pictures,active reference pictures>> a single video 834 coding operation can: use. 835 * [[video-std-header-version]] pname:stdHeaderVersion is a 836 slink:VkExtensionProperties structure reporting the Video Std header 837 name and version supported for the video profile. 838 839ifdef::VK_KHR_video_decode_queue[] 840[NOTE] 841.Note 842==== 843It is common for video compression standards to allow using all reference 844pictures associated with active DPB slots as active reference pictures, 845hence for video decode profiles the values returned in pname:maxDpbSlots and 846pname:maxActiveReferencePictures are often equal. 847ifdef::VK_KHR_video_decode_h264[] 848Similarly, in case of video decode profiles supporting field pictures the 849value of pname:maxActiveReferencePictures often equals 850[eq]#pname:maxDpbSlots {times} 2#. 851endif::VK_KHR_video_decode_h264[] 852==== 853endif::VK_KHR_video_decode_queue[] 854 855include::{generated}/validity/structs/VkVideoCapabilitiesKHR.adoc[] 856-- 857 858[open,refpage='VkVideoCapabilityFlagBitsKHR',desc='Video decode and encode capability bits',type='enums'] 859-- 860Bits which can: be set in slink:VkVideoCapabilitiesKHR::pname:flags are: 861 862include::{generated}/api/enums/VkVideoCapabilityFlagBitsKHR.adoc[] 863 864 * ename:VK_VIDEO_CAPABILITY_PROTECTED_CONTENT_BIT_KHR indicates that video 865 sessions support producing and consuming protected content. 866 * [[separate-reference-images]] 867 ename:VK_VIDEO_CAPABILITY_SEPARATE_REFERENCE_IMAGES_BIT_KHR indicates 868 that the <<video-picture-resources,video picture resources>> associated 869 with the <<dpb-slot,DPB slots>> of a video session can: be backed by 870 separate sname:VkImage objects. 871 If this capability flag is not present, then all DPB slots of a video 872 session must: be associated with video picture resources backed by the 873 same sname:VkImage object (e.g. using different layers of the same 874 image). 875-- 876 877[open,refpage='VkVideoCapabilityFlagsKHR',desc='Bitmask of VkVideoCapabilitiesFlagBitsKHR',type='flags'] 878-- 879include::{generated}/api/flags/VkVideoCapabilityFlagsKHR.adoc[] 880 881tname:VkVideoCapabilityFlagsKHR is a bitmask type for setting a mask of zero 882or more elink:VkVideoCapabilityFlagBitsKHR. 883-- 884 885 886[[video-format-capabilities]] 887=== Video Format Capabilities 888 889[open,refpage='vkGetPhysicalDeviceVideoFormatPropertiesKHR',desc='Query supported video decode and encode image formats and capabilities',type='protos'] 890-- 891To enumerate the supported output, input and DPB image formats and 892corresponding capabilities for a specific video profile, call: 893 894include::{generated}/api/protos/vkGetPhysicalDeviceVideoFormatPropertiesKHR.adoc[] 895 896 * pname:physicalDevice is the physical device from which to query the 897 video format properties. 898 * pname:pVideoFormatInfo is a pointer to a 899 slink:VkPhysicalDeviceVideoFormatInfoKHR structure specifying the usage 900 and video profiles for which supported image formats and capabilities 901 are returned. 902 * pname:pVideoFormatPropertyCount is a pointer to an integer related to 903 the number of video format properties available or queried, as described 904 below. 905 * pname:pVideoFormatProperties is a pointer to an array of 906 slink:VkVideoFormatPropertiesKHR structures in which supported image 907 formats and capabilities are returned. 908 909If pname:pVideoFormatProperties is `NULL`, then the number of video format 910properties supported for the given pname:physicalDevice is returned in 911pname:pVideoFormatPropertyCount. 912Otherwise, pname:pVideoFormatPropertyCount must: point to a variable set by 913the user to the number of elements in the pname:pVideoFormatProperties 914array, and on return the variable is overwritten with the number of values 915actually written to pname:pVideoFormatProperties. 916If the value of pname:pVideoFormatPropertyCount is less than the number of 917video format properties supported, at most pname:pVideoFormatPropertyCount 918values will be written to pname:pVideoFormatProperties, and 919ename:VK_INCOMPLETE will be returned instead of ename:VK_SUCCESS, to 920indicate that not all the available values were returned. 921 922Video format properties are always queried with respect to a specific set of 923video profiles. 924These are specified by chaining the slink:VkVideoProfileListInfoKHR 925structure to pname:pVideoFormatInfo. 926 927For most use cases, the images are used by a single video session and a 928single video profile is provided. 929For a use case such as video transcoding, where a decode session output 930image can: be used as encode input in one or more encode sessions, multiple 931video profiles corresponding to the video sessions that will share the image 932must: be provided. 933 934If any of the <<video-profiles,video profiles>> specified via 935slink:VkVideoProfileListInfoKHR::pname:pProfiles are not supported, then 936this command returns one of the <<video-profile-error-codes, 937video-profile-specific error codes>>. 938Furthermore, if slink:VkPhysicalDeviceVideoFormatInfoKHR::pname:imageUsage 939includes any image usage flags not supported by the specified video 940profiles, then this command returns 941ename:VK_ERROR_IMAGE_USAGE_NOT_SUPPORTED_KHR. 942 943ifdef::VK_KHR_video_decode_queue[] 944This command also returns ename:VK_ERROR_IMAGE_USAGE_NOT_SUPPORTED_KHR if 945slink:VkPhysicalDeviceVideoFormatInfoKHR::pname:imageUsage does not include 946the appropriate flags as dictated by the decode capability flags returned in 947slink:VkVideoDecodeCapabilitiesKHR::pname:flags for any of the profiles 948specified in the slink:VkVideoProfileListInfoKHR structure provided in the 949pname:pNext chain of pname:pVideoFormatInfo. 950 951If the decode capability flags include 952ename:VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_COINCIDE_BIT_KHR but not 953ename:VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_DISTINCT_BIT_KHR, then in 954order to query video format properties for decode DPB and output usage, 955slink:VkPhysicalDeviceVideoFormatInfoKHR::pname:imageUsage must: include 956both ename:VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR and 957ename:VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR. 958Otherwise, the call will fail with 959ename:VK_ERROR_IMAGE_USAGE_NOT_SUPPORTED_KHR. 960 961If the decode capability flags include 962ename:VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_DISTINCT_BIT_KHR but not 963ename:VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_COINCIDE_BIT_KHR, then in 964order to query video format properties for decode DPB usage, 965slink:VkPhysicalDeviceVideoFormatInfoKHR::pname:imageUsage must: include 966ename:VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR, but not 967ename:VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR. 968Otherwise, the call will fail with 969ename:VK_ERROR_IMAGE_USAGE_NOT_SUPPORTED_KHR. 970Similarly, to query video format properties for decode output usage, 971slink:VkPhysicalDeviceVideoFormatInfoKHR::pname:imageUsage must: include 972ename:VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR, but not 973ename:VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR. 974Otherwise, the call will fail with 975ename:VK_ERROR_IMAGE_USAGE_NOT_SUPPORTED_KHR. 976endif::VK_KHR_video_decode_queue[] 977 978The pname:imageUsage member of the slink:VkPhysicalDeviceVideoFormatInfoKHR 979structure specifies the expected video usage flags that the returned video 980formats must: support. 981Correspondingly, the pname:imageUsageFlags member of each 982slink:VkVideoFormatPropertiesKHR structure returned will contain at least 983the same set of image usage flags. 984 985If the implementation supports using video input, output, or DPB images of a 986particular format in operations other than video decode/encode then the 987pname:imageUsageFlags member of the corresponding 988slink:VkVideoFormatPropertiesKHR structure returned will include additional 989image usage flags indicating that. 990 991[NOTE] 992.Note 993==== 994For most use cases, only decode or encode related usage flags are going to 995be specified. 996For a use case such as transcode, if the image were to be shared between 997decode and encode session(s), then both decode and encode related usage 998flags can: be set. 999==== 1000 1001Multiple sname:VkVideoFormatPropertiesKHR entries may: be returned with the 1002same pname:format member with different pname:componentMapping, 1003pname:imageType, or pname:imageTiling values, as described later. 1004 1005In addition, a different set of sname:VkVideoFormatPropertiesKHR entries 1006may: be returned depending on the pname:imageUsage member of the 1007sname:VkPhysicalDeviceVideoFormatInfoKHR structure, even for the same set of 1008video profiles, for example, based on whether encode input, encode DPB, 1009decode output, and/or decode DPB usage is requested. 1010 1011The application can: select the parameters returned in the 1012sname:VkVideoFormatPropertiesKHR entries and use compatible parameters when 1013creating the input, output, and DPB images. 1014The implementation will report all image creation and usage flags that are 1015valid for images used with the requested video profiles but applications 1016should: create images only with those that are necessary for the particular 1017use case. 1018 1019Before creating an image, the application can: obtain the complete set of 1020supported image format features by calling 1021flink:vkGetPhysicalDeviceImageFormatProperties2 using parameters derived 1022from the members of one of the reported sname:VkVideoFormatPropertiesKHR 1023entries and adding the same slink:VkVideoProfileListInfoKHR structure to the 1024pname:pNext chain of slink:VkPhysicalDeviceImageFormatInfo2. 1025 1026The following applies to all sname:VkVideoFormatPropertiesKHR entries 1027returned by fname:vkGetPhysicalDeviceVideoFormatPropertiesKHR: 1028 1029 * flink:vkGetPhysicalDeviceFormatProperties2 must: succeed when called 1030 with sname:VkVideoFormatPropertiesKHR::pname:format 1031 * If sname:VkVideoFormatPropertiesKHR::pname:imageTiling is 1032 ename:VK_IMAGE_TILING_OPTIMAL, then the pname:optimalTilingFeatures 1033 returned by flink:vkGetPhysicalDeviceFormatProperties2 must: include all 1034 format features required by the image usage flags reported in 1035 sname:VkVideoFormatPropertiesKHR::pname:imageUsageFlags for the format, 1036 as indicated in the <<format-feature-dependent-usage-flags,Format 1037 Feature Dependent Usage Flags>> section. 1038 * If sname:VkVideoFormatPropertiesKHR::pname:imageTiling is 1039 ename:VK_IMAGE_TILING_LINEAR, then the pname:linearTilingFeatures 1040 returned by flink:vkGetPhysicalDeviceFormatProperties2 must: include all 1041 format features required by the image usage flags reported in 1042 sname:VkVideoFormatPropertiesKHR::pname:imageUsageFlags for the format, 1043 as indicated in the <<format-feature-dependent-usage-flags,Format 1044 Feature Dependent Usage Flags>> section. 1045 * flink:vkGetPhysicalDeviceImageFormatProperties2 must: succeed when 1046 called with a slink:VkPhysicalDeviceImageFormatInfo2 structure 1047 containing the following information: 1048 ** The pname:pNext chain including the same 1049 slink:VkVideoProfileListInfoKHR structure used to call 1050 fname:vkGetPhysicalDeviceVideoFormatPropertiesKHR. 1051 ** pname:format set to the value of 1052 sname:VkVideoFormatPropertiesKHR::pname:format. 1053 ** pname:type set to the value of 1054 sname:VkVideoFormatPropertiesKHR::pname:imageType. 1055 ** pname:tiling set to the value of 1056 sname:VkVideoFormatPropertiesKHR::pname:imageTiling. 1057 ** pname:usage set to the value of 1058 sname:VkVideoFormatPropertiesKHR::pname:imageUsageFlags. 1059 ** pname:flags set to the value of 1060 sname:VkVideoFormatPropertiesKHR::pname:imageCreateFlags. 1061 1062The pname:componentMapping member of sname:VkVideoFormatPropertiesKHR 1063defines the ordering of the {YCbCr} color channels from the perspective of 1064the video codec operations specified in slink:VkVideoProfileListInfoKHR. 1065For example, if the implementation produces video decode output with the 1066format ename:VK_FORMAT_G8_B8R8_2PLANE_420_UNORM where the blue and red 1067chrominance channels are swapped then the pname:componentMapping member of 1068the corresponding sname:VkVideoFormatPropertiesKHR structure will have the 1069following member values: 1070 1071[source,c++] 1072---- 1073components.r = VK_COMPONENT_SWIZZLE_B; // Cb component 1074components.g = VK_COMPONENT_SWIZZLE_IDENTITY; // Y component 1075components.b = VK_COMPONENT_SWIZZLE_R; // Cr component 1076components.a = VK_COMPONENT_SWIZZLE_IDENTITY; // unused, defaults to 1.0 1077---- 1078 1079.Valid Usage 1080**** 1081 * [[VUID-vkGetPhysicalDeviceVideoFormatPropertiesKHR-pNext-06812]] 1082 The pname:pNext chain of pname:pVideoFormatInfo must: include a 1083 slink:VkVideoProfileListInfoKHR structure with pname:profileCount 1084 greater than `0` 1085**** 1086 1087include::{generated}/validity/protos/vkGetPhysicalDeviceVideoFormatPropertiesKHR.adoc[] 1088-- 1089 1090[open,refpage='VkPhysicalDeviceVideoFormatInfoKHR',desc='Structure specifying the codec video format',type='structs'] 1091-- 1092The sname:VkPhysicalDeviceVideoFormatInfoKHR structure is defined as: 1093 1094include::{generated}/api/structs/VkPhysicalDeviceVideoFormatInfoKHR.adoc[] 1095 1096 * pname:sType is a elink:VkStructureType value identifying this structure. 1097 * pname:pNext is `NULL` or a pointer to a structure extending this 1098 structure. 1099 * pname:imageUsage is a bitmask of elink:VkImageUsageFlagBits specifying 1100 the intended usage of the video images. 1101 1102include::{generated}/validity/structs/VkPhysicalDeviceVideoFormatInfoKHR.adoc[] 1103-- 1104 1105[open,refpage='VkVideoFormatPropertiesKHR',desc='Structure enumerating the video image formats',type='structs'] 1106-- 1107The sname:VkVideoFormatPropertiesKHR structure is defined as: 1108 1109include::{generated}/api/structs/VkVideoFormatPropertiesKHR.adoc[] 1110 1111 * pname:sType is a elink:VkStructureType value identifying this structure. 1112 * pname:pNext is `NULL` or a pointer to a structure extending this 1113 structure. 1114 * pname:format is a elink:VkFormat that specifies the format that can: be 1115 used with the specified video profiles and image usages. 1116 * pname:componentMapping defines the color channel order used for the 1117 format. 1118 pname:format along with pname:componentMapping describe how the color 1119 channels are ordered when producing video decoder output or are expected 1120 to be ordered in video encoder input, when applicable. 1121 If the pname:format reported does not require component swizzling then 1122 all members of pname:componentMapping will be set to 1123 ename:VK_COMPONENT_SWIZZLE_IDENTITY. 1124 * pname:imageCreateFlags is a bitmask of elink:VkImageCreateFlagBits 1125 specifying the supported image creation flags for the format. 1126 * pname:imageType is a elink:VkImageType that specifies the image type the 1127 format can: be used with. 1128 * pname:imageTiling is a elink:VkImageTiling that specifies the image 1129 tiling the format can: be used with. 1130 * pname:imageUsageFlags is a bitmask of elink:VkImageUsageFlagBits 1131 specifying the supported image usage flags for the format. 1132 1133include::{generated}/validity/structs/VkVideoFormatPropertiesKHR.adoc[] 1134-- 1135 1136[[video-session]] 1137== Video Sessions 1138 1139[open,refpage='VkVideoSessionKHR',desc='Opaque handle to a video session object',type='handles'] 1140-- 1141Video sessions are objects that represent and maintain the state needed to 1142perform video decode or encode operations using a specific video profile. 1143 1144ifdef::VK_KHR_video_encode_queue[] 1145In case of video encode profiles this includes the current 1146<<encode-rate-control,rate control>> configuration and the currently set 1147<<encode-quality-level,video encode quality level>>. 1148endif::VK_KHR_video_encode_queue[] 1149 1150Video sessions are represented by sname:VkVideoSessionKHR handles: 1151 1152include::{generated}/api/handles/VkVideoSessionKHR.adoc[] 1153-- 1154 1155 1156[[video-session-creation]] 1157=== Creating a Video Session 1158 1159[open,refpage='vkCreateVideoSessionKHR',desc='Creates a video session object',type='protos'] 1160-- 1161To create a video session object, call: 1162 1163include::{generated}/api/protos/vkCreateVideoSessionKHR.adoc[] 1164 1165 * pname:device is the logical device that creates the video session. 1166 * pname:pCreateInfo is a pointer to a slink:VkVideoSessionCreateInfoKHR 1167 structure containing parameters to be used to create the video session. 1168 * pname:pAllocator controls host memory allocation as described in the 1169 <<memory-allocation, Memory Allocation>> chapter. 1170 * pname:pVideoSession is a pointer to a slink:VkVideoSessionKHR handle in 1171 which the resulting video session object is returned. 1172 1173The resulting video session object is said to be created with the video 1174codec operation specified in 1175pname:pCreateInfo->pVideoProfile->videoCodecOperation. 1176 1177The name and version of the codec-specific Video Std header to be used with 1178the video session is specified by the slink:VkExtensionProperties structure 1179pointed to by pname:pCreateInfo->pStdHeaderVersion. 1180If a non-existent or unsupported Video Std header version is specified in 1181pname:pCreateInfo->pStdHeaderVersion->specVersion, then this command returns 1182ename:VK_ERROR_VIDEO_STD_VERSION_NOT_SUPPORTED_KHR. 1183 1184[[video-session-uninitialized]] 1185Video session objects are created in _uninitialized_ state. 1186In order to transition the video session into _initial_ state, the 1187application must: issue a flink:vkCmdControlVideoCodingKHR command with 1188slink:VkVideoCodingControlInfoKHR::pname:flags including 1189ename:VK_VIDEO_CODING_CONTROL_RESET_BIT_KHR. 1190 1191Video session objects also maintain the 1192<<dpb-state-and-backing-store,state>> of the DPB. 1193The number of DPB slots usable with the created video session is specified 1194in pname:pCreateInfo->maxDpbSlots, and each slot is initially in the 1195<<dpb-slot-states,inactive state>>. 1196 1197Each <<dpb-slot,DPB slot>> maintained by the created video session can: 1198refer to a <<reference-picture,reference picture>> representing a video 1199frame. 1200 1201ifdef::VK_KHR_video_decode_h264[] 1202[[decode-h264-interlaced-support]] 1203In addition, if the pname:videoCodecOperation member of the 1204slink:VkVideoProfileInfoKHR structure pointed to by 1205pname:pCreateInfo->pVideoProfile is 1206ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR and the 1207pname:pictureLayout member of the slink:VkVideoDecodeH264ProfileInfoKHR 1208structure provided in the slink:VkVideoProfileInfoKHR::pname:pNext chain is 1209not ename:VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_PROGRESSIVE_KHR, then the 1210created video session supports _interlaced_ frames and each <<dpb-slot,DPB 1211slot>> maintained by the created video session can: instead refer to 1212separate top field and bottom field <<reference-picture,reference pictures>> 1213that together can: represent a full video frame. 1214In this case, it is up to the application, driven by the video content, 1215whether it associates any individual DPB slot with separate top and/or 1216bottom field pictures or a single picture representing a full frame. 1217endif::VK_KHR_video_decode_h264[] 1218 1219The created video session can: be used to perform video coding operations 1220using video frames up to the maximum size specified in 1221pname:pCreateInfo->maxCodedExtent. 1222The minimum frame size allowed is implicitly derived from 1223slink:VkVideoCapabilitiesKHR::pname:minCodedExtent, as returned by 1224flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video profile 1225specified by pname:pCreateInfo->pVideoProfile. 1226Accordingly, the created video session is said to be created with a 1227pname:minCodedExtent equal to that. 1228 1229ifdef::VK_KHR_video_encode_queue[] 1230In case of video session objects created with a video encode operation, 1231implementations may: return the 1232ename:VK_ERROR_INVALID_VIDEO_STD_PARAMETERS_KHR error if any of the 1233specified Video Std parameters do not adhere to the syntactic or semantic 1234requirements of the used video compression standard, or if values derived 1235from parameters according to the rules defined by the used video compression 1236standard do not adhere to the capabilities of the video compression standard 1237or the implementation. 1238 1239[NOTE] 1240.Note 1241==== 1242Applications should: not rely on the 1243ename:VK_ERROR_INVALID_VIDEO_STD_PARAMETERS_KHR error being returned by any 1244command as a means to verify Video Std parameters, as implementations are 1245not required to report the error in any specific set of cases. 1246==== 1247endif::VK_KHR_video_encode_queue[] 1248 1249include::{generated}/validity/protos/vkCreateVideoSessionKHR.adoc[] 1250-- 1251 1252[open,refpage='VkVideoSessionCreateInfoKHR',desc='Structure specifying parameters of a newly created video session',type='structs'] 1253-- 1254The slink:VkVideoSessionCreateInfoKHR structure is defined as: 1255 1256include::{generated}/api/structs/VkVideoSessionCreateInfoKHR.adoc[] 1257 1258 * pname:sType is a elink:VkStructureType value identifying this structure. 1259 * pname:pNext is `NULL` or a pointer to a structure extending this 1260 structure. 1261 * pname:queueFamilyIndex is the index of the queue family the created 1262 video session will be used with. 1263 * pname:flags is a bitmask of elink:VkVideoSessionCreateFlagBitsKHR 1264 specifying creation flags. 1265 * pname:pVideoProfile is a pointer to a slink:VkVideoProfileInfoKHR 1266 structure specifying the video profile the created video session will be 1267 used with. 1268 * pname:pictureFormat is the image format the created video session will 1269 be used with. 1270ifdef::VK_KHR_video_decode_queue[] 1271 If pname:pVideoProfile->videoCodecOperation specifies a decode 1272 operation, then pname:pictureFormat is the image format of 1273 <<decode-output-picture, decode output pictures>> usable with the 1274 created video session. 1275endif::VK_KHR_video_decode_queue[] 1276ifdef::VK_KHR_video_encode_queue[] 1277 If pname:pVideoProfile->videoCodecOperation specifies an encode 1278 operation, then pname:pictureFormat is the image format of 1279 <<encode-input-picture, encode input pictures>> usable with the created 1280 video session. 1281endif::VK_KHR_video_encode_queue[] 1282 * pname:maxCodedExtent is the maximum width and height of the coded frames 1283 the created video session will be used with. 1284 * pname:referencePictureFormat is the image format of 1285 <<reference-picture,reference pictures>> stored in the <<dpb,DPB>> the 1286 created video session will be used with. 1287 * pname:maxDpbSlots is the maximum number of <<dpb-slot,DPB Slots>> that 1288 can: be used with the created video session. 1289 * pname:maxActiveReferencePictures is the maximum number of 1290 <<active-reference-pictures,active reference pictures>> that can: be 1291 used in a single video coding operation using the created video session. 1292 * pname:pStdHeaderVersion is a pointer to a slink:VkExtensionProperties 1293 structure requesting the Video Std header version to use for the 1294 pname:videoCodecOperation specified in pname:pVideoProfile. 1295 1296.Valid Usage 1297**** 1298 * [[VUID-VkVideoSessionCreateInfoKHR-protectedMemory-07189]] 1299 If the <<features-protectedMemory, pname:protectedMemory>> feature is 1300 not enabled or if slink:VkVideoCapabilitiesKHR::pname:flags does not 1301 include ename:VK_VIDEO_CAPABILITY_PROTECTED_CONTENT_BIT_KHR, as returned 1302 by flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video profile 1303 specified by pname:pVideoProfile, then pname:flags must: not include 1304 ename:VK_VIDEO_SESSION_CREATE_PROTECTED_CONTENT_BIT_KHR 1305ifdef::VK_KHR_video_maintenance1[] 1306 * [[VUID-VkVideoSessionCreateInfoKHR-flags-08371]] 1307 If pname:flags includes 1308 ename:VK_VIDEO_SESSION_CREATE_INLINE_QUERIES_BIT_KHR, then 1309 <<features-videoMaintenance1,pname:videoMaintenance1>> must: be enabled 1310endif::VK_KHR_video_maintenance1[] 1311 * [[VUID-VkVideoSessionCreateInfoKHR-pVideoProfile-04845]] 1312 pname:pVideoProfile must: be a <<video-profile-support, supported video 1313 profile>> 1314 * [[VUID-VkVideoSessionCreateInfoKHR-maxDpbSlots-04847]] 1315 pname:maxDpbSlots must: be less than or equal to 1316 slink:VkVideoCapabilitiesKHR::pname:maxDpbSlots, as returned by 1317 flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video profile 1318 specified by pname:pVideoProfile 1319 * [[VUID-VkVideoSessionCreateInfoKHR-maxActiveReferencePictures-04849]] 1320 pname:maxActiveReferencePictures must: be less than or equal to 1321 slink:VkVideoCapabilitiesKHR::pname:maxActiveReferencePictures, as 1322 returned by flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video 1323 profile specified by pname:pVideoProfile 1324 * [[VUID-VkVideoSessionCreateInfoKHR-maxDpbSlots-04850]] 1325 If either pname:maxDpbSlots or pname:maxActiveReferencePictures is `0`, 1326 then both must: be `0` 1327 * [[VUID-VkVideoSessionCreateInfoKHR-maxCodedExtent-04851]] 1328 pname:maxCodedExtent must: be between 1329 slink:VkVideoCapabilitiesKHR::pname:minCodedExtent and 1330 slink:VkVideoCapabilitiesKHR::pname:maxCodedExtent, inclusive, as 1331 returned by flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video 1332 profile specified by pname:pVideoProfile 1333ifdef::VK_KHR_video_decode_queue[] 1334 * [[VUID-VkVideoSessionCreateInfoKHR-referencePictureFormat-04852]] 1335 If pname:pVideoProfile->videoCodecOperation specifies a decode operation 1336 and pname:maxActiveReferencePictures is greater than `0`, then 1337 pname:referencePictureFormat must: be one of the supported decode DPB 1338 formats, as returned by 1339 flink:vkGetPhysicalDeviceVideoFormatPropertiesKHR in 1340 slink:VkVideoFormatPropertiesKHR::pname:format when called with the 1341 pname:imageUsage member of its pname:pVideoFormatInfo parameter 1342 containing ename:VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR, and with a 1343 slink:VkVideoProfileListInfoKHR structure specified in the pname:pNext 1344 chain of its pname:pVideoFormatInfo parameter whose pname:pProfiles 1345 member contains an element matching pname:pVideoProfile 1346endif::VK_KHR_video_decode_queue[] 1347ifdef::VK_KHR_video_encode_queue[] 1348 * [[VUID-VkVideoSessionCreateInfoKHR-referencePictureFormat-06814]] 1349 If pname:pVideoProfile->videoCodecOperation specifies an encode 1350 operation and pname:maxActiveReferencePictures is greater than `0`, then 1351 pname:referencePictureFormat must: be one of the supported decode DPB 1352 formats, as returned by then pname:referencePictureFormat must: be one 1353 of the supported encode DPB formats, as returned by 1354 flink:vkGetPhysicalDeviceVideoFormatPropertiesKHR in 1355 slink:VkVideoFormatPropertiesKHR::pname:format when called with the 1356 pname:imageUsage member of its pname:pVideoFormatInfo parameter 1357 containing ename:VK_IMAGE_USAGE_VIDEO_ENCODE_DPB_BIT_KHR, and with a 1358 slink:VkVideoProfileListInfoKHR structure specified in the pname:pNext 1359 chain of its pname:pVideoFormatInfo parameter whose pname:pProfiles 1360 member contains an element matching pname:pVideoProfile 1361endif::VK_KHR_video_encode_queue[] 1362ifdef::VK_KHR_video_decode_queue[] 1363 * [[VUID-VkVideoSessionCreateInfoKHR-pictureFormat-04853]] 1364 If pname:pVideoProfile->videoCodecOperation specifies a decode 1365 operation, then pname:pictureFormat must: be one of the supported decode 1366 output formats, as returned by 1367 flink:vkGetPhysicalDeviceVideoFormatPropertiesKHR in 1368 slink:VkVideoFormatPropertiesKHR::pname:format when called with the 1369 pname:imageUsage member of its pname:pVideoFormatInfo parameter 1370 containing ename:VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR, and with a 1371 slink:VkVideoProfileListInfoKHR structure specified in the pname:pNext 1372 chain of its pname:pVideoFormatInfo parameter whose pname:pProfiles 1373 member contains an element matching pname:pVideoProfile 1374endif::VK_KHR_video_decode_queue[] 1375ifdef::VK_KHR_video_encode_queue[] 1376 * [[VUID-VkVideoSessionCreateInfoKHR-pictureFormat-04854]] 1377 If pname:pVideoProfile->videoCodecOperation specifies an encode 1378 operation, then pname:pictureFormat must: be one of the supported encode 1379 input formats, as returned by 1380 flink:vkGetPhysicalDeviceVideoFormatPropertiesKHR in 1381 slink:VkVideoFormatPropertiesKHR::pname:format when called with the 1382 pname:imageUsage member of its pname:pVideoFormatInfo parameter 1383 containing ename:VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR, and with a 1384 slink:VkVideoProfileListInfoKHR structure specified in the pname:pNext 1385 chain of its pname:pVideoFormatInfo parameter whose pname:pProfiles 1386 member contains an element matching pname:pVideoProfile 1387endif::VK_KHR_video_encode_queue[] 1388 * [[VUID-VkVideoSessionCreateInfoKHR-pStdHeaderVersion-07190]] 1389 pname:pStdHeaderVersion->extensionName must: match 1390 slink:VkVideoCapabilitiesKHR::pname:stdHeaderVersion.extensionName, as 1391 returned by flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video 1392 profile specified by pname:pVideoProfile 1393 * [[VUID-VkVideoSessionCreateInfoKHR-pStdHeaderVersion-07191]] 1394 pname:pStdHeaderVersion->specVersion must: be less than or equal to 1395 slink:VkVideoCapabilitiesKHR::pname:stdHeaderVersion.specVersion, as 1396 returned by flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video 1397 profile specified by pname:pVideoProfile 1398ifdef::VK_KHR_video_encode_h264[] 1399 * [[VUID-VkVideoSessionCreateInfoKHR-pVideoProfile-08251]] 1400 If pname:pVideoProfile->videoCodecOperation is 1401 ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR and the pname:pNext 1402 chain of this structure includes a 1403 slink:VkVideoEncodeH264SessionCreateInfoKHR structure, then its 1404 pname:maxLevelIdc member must: be less than or equal to 1405 slink:VkVideoEncodeH264CapabilitiesKHR::pname:maxLevelIdc, as returned 1406 by flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video profile 1407 specified in pname:pVideoProfile 1408endif::VK_KHR_video_encode_h264[] 1409ifdef::VK_KHR_video_encode_h265[] 1410 * [[VUID-VkVideoSessionCreateInfoKHR-pVideoProfile-08252]] 1411 If pname:pVideoProfile->videoCodecOperation is 1412 ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR and the pname:pNext 1413 chain of this structure includes a 1414 slink:VkVideoEncodeH265SessionCreateInfoKHR structure, then its 1415 pname:maxLevelIdc member must: be less than or equal to 1416 slink:VkVideoEncodeH265CapabilitiesKHR::pname:maxLevelIdc, as returned 1417 by flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video profile 1418 specified in pname:pVideoProfile 1419endif::VK_KHR_video_encode_h265[] 1420**** 1421 1422include::{generated}/validity/structs/VkVideoSessionCreateInfoKHR.adoc[] 1423-- 1424 1425[open,refpage='VkVideoSessionCreateFlagBitsKHR',desc='Video session creation flags',type='enums'] 1426-- 1427Bits which can: be set in slink:VkVideoSessionCreateInfoKHR::pname:flags 1428are: 1429 1430include::{generated}/api/enums/VkVideoSessionCreateFlagBitsKHR.adoc[] 1431 1432 * ename:VK_VIDEO_SESSION_CREATE_PROTECTED_CONTENT_BIT_KHR specifies that 1433 the video session uses protected video content. 1434ifdef::VK_KHR_video_encode_queue[] 1435 * [[encode-optimizing-overrides]] 1436 ename:VK_VIDEO_SESSION_CREATE_ALLOW_ENCODE_PARAMETER_OPTIMIZATIONS_BIT_KHR 1437 specifies that the implementation is allowed to 1438 <<encode-overrides,override>> video session parameters and other 1439 codec-specific encoding parameters to optimize video encode operations 1440 based on the use case information specified in the 1441 <<video-profiles,video profile>> and the used 1442 <<encode-quality-level,video encode quality level>>. 1443+ 1444[NOTE] 1445.Note 1446==== 1447Not specifying 1448ename:VK_VIDEO_SESSION_CREATE_ALLOW_ENCODE_PARAMETER_OPTIMIZATIONS_BIT_KHR 1449does not guarantee that the implementation will not do any codec-specific 1450parameter overrides, as certain overrides are necessary for the correct 1451operation of the video encoder implementation due to limitations to the 1452available encoding tools on that implementation. 1453This flag, however, enables the implementation to apply further optimizing 1454overrides. 1455==== 1456endif::VK_KHR_video_encode_queue[] 1457ifdef::VK_KHR_video_maintenance1[] 1458 * ename:VK_VIDEO_SESSION_CREATE_INLINE_QUERIES_BIT_KHR specifies that 1459 queries within video coding scopes using the created video session are 1460 <<video-inline-queries,executed inline>> with video coding operations. 1461endif::VK_KHR_video_maintenance1[] 1462-- 1463 1464[open,refpage='VkVideoSessionCreateFlagsKHR',desc='Bitmask of VkVideoSessionCreateFlagBitsKHR',type='flags'] 1465-- 1466include::{generated}/api/flags/VkVideoSessionCreateFlagsKHR.adoc[] 1467 1468tname:VkVideoSessionCreateFlagsKHR is a bitmask type for setting a mask of 1469zero or more elink:VkVideoSessionCreateFlagBitsKHR. 1470-- 1471 1472 1473[[video-session-destruction]] 1474=== Destroying a Video Session 1475 1476[open,refpage='vkDestroyVideoSessionKHR',desc='Destroy video session object',type='protos'] 1477-- 1478To destroy a video session, call: 1479 1480include::{generated}/api/protos/vkDestroyVideoSessionKHR.adoc[] 1481 1482 * pname:device is the logical device that destroys the video session. 1483 * pname:videoSession is the video session to destroy. 1484 * pname:pAllocator controls host memory allocation as described in the 1485 <<memory-allocation, Memory Allocation>> chapter. 1486 1487.Valid Usage 1488**** 1489 * [[VUID-vkDestroyVideoSessionKHR-videoSession-07192]] 1490 All submitted commands that refer to pname:videoSession must: have 1491 completed execution 1492 * [[VUID-vkDestroyVideoSessionKHR-videoSession-07193]] 1493 If sname:VkAllocationCallbacks were provided when pname:videoSession was 1494 created, a compatible set of callbacks must: be provided here 1495 * [[VUID-vkDestroyVideoSessionKHR-videoSession-07194]] 1496 If no sname:VkAllocationCallbacks were provided when pname:videoSession 1497 was created, pname:pAllocator must: be `NULL` 1498**** 1499 1500include::{generated}/validity/protos/vkDestroyVideoSessionKHR.adoc[] 1501-- 1502 1503 1504[[video-session-memory-association]] 1505=== Video Session Memory Association 1506 1507After creating a video session object, and before the object can: be used to 1508record video coding operations into command buffers using it, the 1509application must: allocate and bind device memory to the video session. 1510Device memory is allocated separately (see <<memory-device>>) and then 1511associated with the video session. 1512 1513Video sessions may: have multiple memory bindings identified by unique 1514unsigned integer values. 1515Appropriate device memory must: be bound to each such memory binding before 1516using the video session to record command buffer commands with it. 1517 1518[open,refpage='vkGetVideoSessionMemoryRequirementsKHR',desc='Get the memory requirements for a video session',type='protos'] 1519-- 1520To determine the memory requirements for a video session object, call: 1521 1522include::{generated}/api/protos/vkGetVideoSessionMemoryRequirementsKHR.adoc[] 1523 1524 * pname:device is the logical device that owns the video session. 1525 * pname:videoSession is the video session to query. 1526 * pname:pMemoryRequirementsCount is a pointer to an integer related to the 1527 number of memory binding requirements available or queried, as described 1528 below. 1529 * pname:pMemoryRequirements is `NULL` or a pointer to an array of 1530 slink:VkVideoSessionMemoryRequirementsKHR structures in which the memory 1531 binding requirements of the video session are returned. 1532 1533If pname:pMemoryRequirements is `NULL`, then the number of memory bindings 1534required for the video session is returned in 1535pname:pMemoryRequirementsCount. 1536Otherwise, pname:pMemoryRequirementsCount must: point to a variable set by 1537the user with the number of elements in the pname:pMemoryRequirements array, 1538and on return the variable is overwritten with the number of memory binding 1539requirements actually written to pname:pMemoryRequirements. 1540If pname:pMemoryRequirementsCount is less than the number of memory bindings 1541required for the video session, then at most pname:pMemoryRequirementsCount 1542elements will be written to pname:pMemoryRequirements, and 1543ename:VK_INCOMPLETE will be returned, instead of ename:VK_SUCCESS, to 1544indicate that not all required memory binding requirements were returned. 1545 1546include::{generated}/validity/protos/vkGetVideoSessionMemoryRequirementsKHR.adoc[] 1547-- 1548 1549 1550[open,refpage='VkVideoSessionMemoryRequirementsKHR',desc='Structure describing video session memory requirements',type='structs'] 1551-- 1552The sname:VkVideoSessionMemoryRequirementsKHR structure is defined as: 1553 1554include::{generated}/api/structs/VkVideoSessionMemoryRequirementsKHR.adoc[] 1555 1556 * pname:sType is a elink:VkStructureType value identifying this structure. 1557 * pname:pNext is `NULL` or a pointer to a structure extending this 1558 structure. 1559 * pname:memoryBindIndex is the index of the memory binding. 1560 * pname:memoryRequirements is a slink:VkMemoryRequirements structure in 1561 which the requested memory binding requirements for the binding index 1562 specified by pname:memoryBindIndex are returned. 1563 1564include::{generated}/validity/structs/VkVideoSessionMemoryRequirementsKHR.adoc[] 1565-- 1566 1567 1568[open,refpage='vkBindVideoSessionMemoryKHR',desc='Bind Video Memory',type='protos'] 1569-- 1570To attach memory to a video session object, call: 1571 1572include::{generated}/api/protos/vkBindVideoSessionMemoryKHR.adoc[] 1573 1574 * pname:device is the logical device that owns the video session. 1575 * pname:videoSession is the video session to be bound with device memory. 1576 * pname:bindSessionMemoryInfoCount is the number of elements in 1577 pname:pBindSessionMemoryInfos. 1578 * pname:pBindSessionMemoryInfos is a pointer to an array of 1579 pname:bindSessionMemoryInfoCount slink:VkBindVideoSessionMemoryInfoKHR 1580 structures specifying memory regions to be bound to specific memory 1581 bindings of the video session. 1582 1583The valid usage statements below refer to the slink:VkMemoryRequirements 1584structure corresponding to a specific element of 1585pname:pBindSessionMemoryInfos, which is defined as follows: 1586 1587 * If the pname:memoryBindIndex member of the element of 1588 pname:pBindSessionMemoryInfos in question matches the 1589 pname:memoryBindIndex member of one of the elements returned in 1590 pname:pMemoryRequirements when 1591 flink:vkGetVideoSessionMemoryRequirementsKHR is called with the same 1592 pname:videoSession and with pname:pMemoryRequirementsCount equal to 1593 pname:bindSessionMemoryInfoCount, then the pname:memoryRequirements 1594 member of that element of pname:pMemoryRequirements is the 1595 slink:VkMemoryRequirements structure corresponding to the element of 1596 pname:pBindSessionMemoryInfos in question. 1597 * Otherwise the element of pname:pBindSessionMemoryInfos in question is 1598 said to not have a corresponding slink:VkMemoryRequirements structure. 1599 1600.Valid Usage 1601**** 1602 * [[VUID-vkBindVideoSessionMemoryKHR-videoSession-07195]] 1603 The memory binding of pname:videoSession identified by the 1604 pname:memoryBindIndex member of any element of 1605 pname:pBindSessionMemoryInfos must: not already be backed by a memory 1606 object 1607 * [[VUID-vkBindVideoSessionMemoryKHR-memoryBindIndex-07196]] 1608 The pname:memoryBindIndex member of each element of 1609 pname:pBindSessionMemoryInfos must: be unique within 1610 pname:pBindSessionMemoryInfos 1611 * [[VUID-vkBindVideoSessionMemoryKHR-pBindSessionMemoryInfos-07197]] 1612 Each element of pname:pBindSessionMemoryInfos must: have a corresponding 1613 slink:VkMemoryRequirements structure 1614 * [[VUID-vkBindVideoSessionMemoryKHR-pBindSessionMemoryInfos-07198]] 1615 If an element of pname:pBindSessionMemoryInfos has a corresponding 1616 slink:VkMemoryRequirements structure, then the pname:memory member of 1617 that element of pname:pBindSessionMemoryInfos must: have been allocated 1618 using one of the memory types allowed in the pname:memoryTypeBits member 1619 of the corresponding slink:VkMemoryRequirements structure 1620 * [[VUID-vkBindVideoSessionMemoryKHR-pBindSessionMemoryInfos-07199]] 1621 If an element of pname:pBindSessionMemoryInfos has a corresponding 1622 slink:VkMemoryRequirements structure, then the pname:memoryOffset member 1623 of that element of pname:pBindSessionMemoryInfos must: be an integer 1624 multiple of the pname:alignment member of the corresponding 1625 slink:VkMemoryRequirements structure 1626 * [[VUID-vkBindVideoSessionMemoryKHR-pBindSessionMemoryInfos-07200]] 1627 If an element of pname:pBindSessionMemoryInfos has a corresponding 1628 slink:VkMemoryRequirements structure, then the pname:memorySize member 1629 of that element of pname:pBindSessionMemoryInfos must: equal the 1630 pname:size member of the corresponding slink:VkMemoryRequirements 1631 structure 1632**** 1633 1634include::{generated}/validity/protos/vkBindVideoSessionMemoryKHR.adoc[] 1635-- 1636 1637[open,refpage='VkBindVideoSessionMemoryInfoKHR',desc='Structure specifying memory bindings for a video session object',type='structs'] 1638-- 1639The sname:VkBindVideoSessionMemoryInfoKHR structure is defined as: 1640 1641include::{generated}/api/structs/VkBindVideoSessionMemoryInfoKHR.adoc[] 1642 1643 * pname:sType is a elink:VkStructureType value identifying this structure. 1644 * pname:pNext is `NULL` or a pointer to a structure extending this 1645 structure. 1646 * pname:memoryBindIndex is the memory binding index to bind memory to. 1647 * pname:memory is the allocated device memory to be bound to the video 1648 session's memory binding with index pname:memoryBindIndex. 1649 * pname:memoryOffset is the start offset of the region of pname:memory 1650 which is to be bound. 1651 * pname:memorySize is the size in bytes of the region of pname:memory, 1652 starting from pname:memoryOffset bytes, to be bound. 1653 1654.Valid Usage 1655**** 1656 * [[VUID-VkBindVideoSessionMemoryInfoKHR-memoryOffset-07201]] 1657 pname:memoryOffset must: be less than the size of pname:memory 1658 * [[VUID-VkBindVideoSessionMemoryInfoKHR-memorySize-07202]] 1659 pname:memorySize must: be less than or equal to the size of pname:memory 1660 minus pname:memoryOffset 1661**** 1662 1663include::{generated}/validity/structs/VkBindVideoSessionMemoryInfoKHR.adoc[] 1664-- 1665 1666 1667[[video-profile-compatibility]] 1668== Video Profile Compatibility 1669 1670Resources and query pools used with a particular video session must: be 1671compatible with the <<video-profiles,video profile>> the video session was 1672created with. 1673 1674A slink:VkBuffer is compatible with a video profile if it was created with 1675the slink:VkBufferCreateInfo::pname:pNext chain including a 1676slink:VkVideoProfileListInfoKHR structure with its pname:pProfiles member 1677containing an element matching the slink:VkVideoProfileInfoKHR structure 1678chain describing the video profile, and 1679slink:VkBufferCreateInfo::pname:usage including at least one bit specific to 1680video coding usage. 1681 1682ifdef::VK_KHR_video_decode_queue[] 1683 * ename:VK_BUFFER_USAGE_VIDEO_DECODE_SRC_BIT_KHR 1684 * ename:VK_BUFFER_USAGE_VIDEO_DECODE_DST_BIT_KHR 1685endif::VK_KHR_video_decode_queue[] 1686ifdef::VK_KHR_video_encode_queue[] 1687 * ename:VK_BUFFER_USAGE_VIDEO_ENCODE_SRC_BIT_KHR 1688 * ename:VK_BUFFER_USAGE_VIDEO_ENCODE_DST_BIT_KHR 1689endif::VK_KHR_video_encode_queue[] 1690 1691ifdef::VK_KHR_video_maintenance1[] 1692A slink:VkBuffer is also compatible with a video profile if it was created 1693with slink:VkBufferCreateInfo::pname:flags including 1694ename:VK_BUFFER_CREATE_VIDEO_PROFILE_INDEPENDENT_BIT_KHR. 1695endif::VK_KHR_video_maintenance1[] 1696 1697A slink:VkImage is compatible with a video profile if it was created with 1698the slink:VkImageCreateInfo::pname:pNext chain including a 1699slink:VkVideoProfileListInfoKHR structure with its pname:pProfiles member 1700containing an element matching the slink:VkVideoProfileInfoKHR structure 1701chain describing the video profile, and slink:VkImageCreateInfo::pname:usage 1702including at least one bit specific to video coding usage. 1703 1704ifdef::VK_KHR_video_decode_queue[] 1705 * ename:VK_IMAGE_USAGE_VIDEO_DECODE_SRC_BIT_KHR 1706 * ename:VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR 1707 * ename:VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR 1708endif::VK_KHR_video_decode_queue[] 1709ifdef::VK_KHR_video_encode_queue[] 1710 * ename:VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR 1711 * ename:VK_IMAGE_USAGE_VIDEO_ENCODE_DST_BIT_KHR 1712 * ename:VK_IMAGE_USAGE_VIDEO_ENCODE_DPB_BIT_KHR 1713endif::VK_KHR_video_encode_queue[] 1714 1715ifdef::VK_KHR_video_maintenance1[] 1716A slink:VkImage is also compatible with a video profile if all of the 1717following conditions are true for the slink:VkImageCreateInfo structure the 1718image was created with: 1719 1720 * slink:VkImageCreateInfo::pname:flags included 1721 ename:VK_IMAGE_CREATE_VIDEO_PROFILE_INDEPENDENT_BIT_KHR. 1722 * The list of slink:VkVideoFormatPropertiesKHR structures, obtained by 1723 calling flink:vkGetPhysicalDeviceVideoFormatPropertiesKHR with 1724 slink:VkPhysicalDeviceVideoFormatInfoKHR::pname:imageUsage equal to the 1725 slink:VkImageCreateInfo::pname:usage the image was created with and the 1726 slink:VkPhysicalDeviceVideoFormatInfoKHR::pname:pNext chain including a 1727 slink:VkVideoProfileListInfoKHR structure with its pname:pProfiles 1728 member containing a single array element specifying the 1729 slink:VkVideoProfileInfoKHR structure chain describing the video profile 1730 in question, contains an element for which all of the following 1731 conditions are true with respect to the slink:VkImageCreateInfo 1732 structure the image was created with: 1733 ** slink:VkImageCreateInfo::pname:format equals 1734 slink:VkVideoFormatPropertiesKHR::pname:format. 1735 ** slink:VkImageCreateInfo::pname:flags only contains bits also set in 1736 slink:VkVideoFormatPropertiesKHR::pname:imageCreateFlags. 1737 ** slink:VkImageCreateInfo::pname:imageType equals 1738 slink:VkVideoFormatPropertiesKHR::pname:imageType. 1739 ** slink:VkImageCreateInfo::pname:tiling equals 1740 slink:VkVideoFormatPropertiesKHR::pname:imageTiling. 1741 ** slink:VkImageCreateInfo::pname:usage only contains bits also set in 1742 slink:VkVideoFormatPropertiesKHR::pname:imageUsageFlags. 1743 1744[NOTE] 1745.Note 1746==== 1747While some of these rules allow creating buffer or image resources that may: 1748be compatible with any video profile, applications should: still prefer to 1749include the specific video profiles the buffer or image resource is expected 1750to be used with (through a slink:VkVideoProfileListInfoKHR structure 1751included in the pname:pNext chain of the corresponding create info 1752structure) whenever the information about the complete set of video profiles 1753is available at resource creation time, to enable the implementation to 1754optimize the created resource for the specific use case. 1755In the absence of that information, the implementation may: have to make 1756conservative decisions about the memory requirements or representation of 1757the resource. 1758==== 1759endif::VK_KHR_video_maintenance1[] 1760 1761A slink:VkImageView is compatible with a video profile if the slink:VkImage 1762it was created from is also compatible with that video profile. 1763 1764A slink:VkQueryPool is compatible with a video profile if it was created 1765with the slink:VkQueryPoolCreateInfo::pname:pNext chain including a 1766slink:VkVideoProfileInfoKHR structure chain describing the same video 1767profile, and slink:VkQueryPoolCreateInfo::pname:queryType having one of the 1768following values: 1769 1770 * ename:VK_QUERY_TYPE_RESULT_STATUS_ONLY_KHR 1771ifdef::VK_KHR_video_encode_queue[] 1772 * ename:VK_QUERY_TYPE_VIDEO_ENCODE_FEEDBACK_KHR 1773endif::VK_KHR_video_encode_queue[] 1774 1775 1776[[video-session-parameters]] 1777== Video Session Parameters 1778 1779Video session parameters objects can: store preprocessed codec-specific 1780parameters used with a compatible video session, and enable reducing the 1781number of parameters needed to be provided and processed by the 1782implementation while recording video coding operations into command buffers. 1783 1784Parameters stored in such objects are _immutable_ to facilitate the 1785concurrent use of the stored parameters in multiple threads. 1786At the same time, new parameters can: be added to existing objects using the 1787flink:vkUpdateVideoSessionParametersKHR command. 1788 1789In order to support concurrent use of the stored immutable parameters while 1790also allowing the video session parameters object to be extended with new 1791parameters, each video session parameters object maintains an _update 1792sequence counter_ that is set to `0` at object creation time and must: be 1793incremented by each subsequent update operation. 1794 1795Certain video sequences that adhere to particular video compression 1796standards permit updating previously supplied parameters. 1797If a parameter update is necessary, the application has the following 1798options: 1799 1800 * Cache the set of parameters on the application side and create a new 1801 video session parameters object adding all the parameters with 1802 appropriate changes, as necessary; or 1803 * Create a new video session parameters object providing only the updated 1804 parameters and the previously used object as the template, which ensures 1805 that parameters not specified at creation time will be copied unmodified 1806 from the template object. 1807 1808The actual types of parameters that can: be stored and the capacity for 1809individual parameter types, and the methods of initializing, updating, and 1810referring to individual parameters are specific to the video codec operation 1811the video session parameters object was created with. 1812 1813ifdef::VK_KHR_video_decode_h264[] 1814 * For ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR these are defined 1815 in the <<decode-h264-parameter-sets,H.264 Decode Parameter Sets>> 1816 section. 1817endif::VK_KHR_video_decode_h264[] 1818ifdef::VK_KHR_video_decode_h265[] 1819 * For ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR these are defined 1820 in the <<decode-h265-parameter-sets,H.265 Decode Parameter Sets>> 1821 section. 1822endif::VK_KHR_video_decode_h265[] 1823ifdef::VK_KHR_video_encode_h264[] 1824 * For ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR these are defined 1825 in the <<encode-h264-parameter-sets,H.264 Encode Parameter Sets>> 1826 section. 1827endif::VK_KHR_video_encode_h264[] 1828ifdef::VK_KHR_video_encode_h265[] 1829 * For ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR these are defined 1830 in the <<encode-h265-parameter-sets,H.265 Encode Parameter Sets>> 1831 section. 1832endif::VK_KHR_video_encode_h265[] 1833 1834ifdef::VK_KHR_video_encode_queue[] 1835Video session parameters objects created with an encode operation are 1836further specialized based on the <<encode-quality-level,video encode quality 1837level>> the video session parameters are used with, as implementations may: 1838apply different sets of <<encode-overrides,parameter overrides>> depending 1839on the used quality level. 1840This enables implementations to store the potentially optimized set of 1841parameters in these objects, further limiting the necessary processing 1842required while recording video encode operations into command buffers. 1843endif::VK_KHR_video_encode_queue[] 1844 1845 1846[open,refpage='VkVideoSessionParametersKHR',desc='Opaque handle to a video session parameters object',type='handles'] 1847-- 1848Video session parameters are represented by 1849sname:VkVideoSessionParametersKHR handles: 1850 1851include::{generated}/api/handles/VkVideoSessionParametersKHR.adoc[] 1852-- 1853 1854 1855[[creating-video-session-parameters]] 1856=== Creating Video Session Parameters 1857 1858[open,refpage='vkCreateVideoSessionParametersKHR',desc='Creates video session parameters object',type='protos'] 1859-- 1860To create a video session parameters object, call: 1861 1862include::{generated}/api/protos/vkCreateVideoSessionParametersKHR.adoc[] 1863 1864 * pname:device is the logical device that creates the video session 1865 parameters object. 1866 * pname:pCreateInfo is a pointer to 1867 slink:VkVideoSessionParametersCreateInfoKHR structure containing 1868 parameters to be used to create the video session parameters object. 1869 * pname:pAllocator controls host memory allocation as described in the 1870 <<memory-allocation, Memory Allocation>> chapter. 1871 * pname:pVideoSessionParameters is a pointer to a 1872 slink:VkVideoSessionParametersKHR handle in which the resulting video 1873 session parameters object is returned. 1874 1875The resulting video session parameters object is said to be created with the 1876video codec operation pname:pCreateInfo->videoSession was created with. 1877 1878ifdef::VK_KHR_video_encode_queue[] 1879Video session parameters objects created with an encode operation are always 1880created with respect to a <<encode-quality-level,video encode quality 1881level>>. 1882By default, the created video session parameters objects are created with 1883quality level zero, unless otherwise specified by including a 1884slink:VkVideoEncodeQualityLevelInfoKHR structure in the 1885pname:pCreateInfo->pNext chain, in which case the video session parameters 1886object is created with the quality level specified in 1887slink:VkVideoEncodeQualityLevelInfoKHR::pname:qualityLevel. 1888endif::VK_KHR_video_encode_queue[] 1889 1890If pname:pCreateInfo->videoSessionParametersTemplate is not 1891dname:VK_NULL_HANDLE, then it will be used as a template for constructing 1892the new video session parameters object. 1893This happens by first adding any parameters according to the additional 1894creation parameters provided in the pname:pCreateInfo->pNext chain, followed 1895by adding any parameters from the template object that have a key that does 1896not match the key of any of the already added parameters. 1897 1898ifdef::VK_KHR_video_encode_queue[] 1899For video session parameters objects created with an encode operation, the 1900template object specified in 1901pname:pCreateInfo->videoSessionParametersTemplate must: have been created 1902with the same <<encode-quality-level,video encode quality level>> as the 1903newly created object. 1904 1905[NOTE] 1906.Note 1907==== 1908This means that codec-specific parameters stored in video session parameters 1909objects can: only be reused across different video encode quality levels by 1910re-specifying them, as previously created video session parameters against 1911other quality levels cannot: be used as template because the original 1912codec-specific parameters (before the implementation may: have applied 1913<<encode-overrides,parameter overrides>>) may: no longer be available in 1914them for the purposes of constructing the derived object. 1915==== 1916endif::VK_KHR_video_encode_queue[] 1917 1918ifdef::VK_KHR_video_decode_h264[] 1919If pname:pCreateInfo->videoSession was created with the video codec 1920operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then the 1921created video session parameters object will initially contain the following 1922sets of parameter entries: 1923 1924 * code:StdVideoH264SequenceParameterSet structures representing 1925 <<decode-h264-sps,H.264 SPS>> entries, as follows: 1926 ** If the pname:pParametersAddInfo member of the 1927 slink:VkVideoDecodeH264SessionParametersCreateInfoKHR structure 1928 provided in the pname:pCreateInfo->pNext chain is not `NULL`, then the 1929 set of code:StdVideoH264SequenceParameterSet entries specified in 1930 pname:pParametersAddInfo->pStdSPSs are added first; 1931 ** If pname:pCreateInfo->videoSessionParametersTemplate is not 1932 dname:VK_NULL_HANDLE, then each code:StdVideoH264SequenceParameterSet 1933 entry stored in it is copied to the created video session parameters 1934 object if the created object does not already contain such an entry 1935 with the same pname:seq_parameter_set_id. 1936 * code:StdVideoH264PictureParameterSet structures representing 1937 <<decode-h264-pps,H.264 PPS>> entries, as follows: 1938 ** If the pname:pParametersAddInfo member of the 1939 slink:VkVideoDecodeH264SessionParametersCreateInfoKHR structure 1940 provided in the pname:pCreateInfo->pNext chain is not `NULL`, then the 1941 set of code:StdVideoH264PictureParameterSet entries specified in 1942 pname:pParametersAddInfo->pStdPPSs are added first; 1943 ** If pname:pCreateInfo->videoSessionParametersTemplate is not 1944 dname:VK_NULL_HANDLE, then each code:StdVideoH264PictureParameterSet 1945 entry stored in it is copied to the created video session parameters 1946 object if the created object does not already contain such an entry 1947 with the same pname:seq_parameter_set_id and 1948 pname:pic_parameter_set_id. 1949endif::VK_KHR_video_decode_h264[] 1950 1951ifdef::VK_KHR_video_decode_h265[] 1952If pname:pCreateInfo->videoSession was created with the video codec 1953operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then the 1954created video session parameters object will initially contain the following 1955sets of parameter entries: 1956 1957 * code:StdVideoH265VideoParameterSet structures representing 1958 <<decode-h265-vps,H.265 VPS>> entries, as follows: 1959 ** If the pname:pParametersAddInfo member of the 1960 slink:VkVideoDecodeH265SessionParametersCreateInfoKHR structure 1961 provided in the pname:pCreateInfo->pNext chain is not `NULL`, then the 1962 set of code:StdVideoH265VideoParameterSet entries specified in 1963 pname:pParametersAddInfo->pStdVPSs are added first; 1964 ** If pname:pCreateInfo->videoSessionParametersTemplate is not 1965 dname:VK_NULL_HANDLE, then each code:StdVideoH265VideoParameterSet 1966 entry stored in it is copied to the created video session parameters 1967 object if the created object does not already contain such an entry 1968 with the same pname:vps_video_parameter_set_id. 1969 * code:StdVideoH265SequenceParameterSet structures representing 1970 <<decode-h265-sps,H.265 SPS>> entries, as follows: 1971 ** If the pname:pParametersAddInfo member of the 1972 slink:VkVideoDecodeH265SessionParametersCreateInfoKHR structure 1973 provided in the pname:pCreateInfo->pNext chain is not `NULL`, then the 1974 set of code:StdVideoH265SequenceParameterSet entries specified in 1975 pname:pParametersAddInfo->pStdSPSs are added first; 1976 ** If pname:pCreateInfo->videoSessionParametersTemplate is not 1977 dname:VK_NULL_HANDLE, then each code:StdVideoH265SequenceParameterSet 1978 entry stored in it is copied to the created video session parameters 1979 object if the created object does not already contain such an entry 1980 with the same pname:sps_video_parameter_set_id and 1981 pname:sps_seq_parameter_set_id. 1982 * code:StdVideoH265PictureParameterSet structures representing 1983 <<decode-h265-pps,H.265 PPS>> entries, as follows: 1984 ** If the pname:pParametersAddInfo member of the 1985 slink:VkVideoDecodeH265SessionParametersCreateInfoKHR structure 1986 provided in the pname:pCreateInfo->pNext chain is not `NULL`, then the 1987 set of code:StdVideoH265PictureParameterSet entries specified in 1988 pname:pParametersAddInfo->pStdPPSs are added first; 1989 ** If pname:pCreateInfo->videoSessionParametersTemplate is not 1990 dname:VK_NULL_HANDLE, then each code:StdVideoH265PictureParameterSet 1991 entry stored in it is copied to the created video session parameters 1992 object if the created object does not already contain such an entry 1993 with the same pname:sps_video_parameter_set_id, 1994 pname:pps_seq_parameter_set_id, and pname:pps_pic_parameter_set_id. 1995endif::VK_KHR_video_decode_h265[] 1996 1997ifdef::VK_KHR_video_encode_h264[] 1998If pname:pCreateInfo->videoSession was created with the video codec 1999operation ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR, then the 2000created video session parameters object will initially contain the following 2001sets of parameter entries: 2002 2003 * code:StdVideoH264SequenceParameterSet structures representing 2004 <<encode-h264-sps,H.264 SPS>> entries, as follows: 2005 ** If the pname:pParametersAddInfo member of the 2006 slink:VkVideoEncodeH264SessionParametersCreateInfoKHR structure 2007 provided in the pname:pCreateInfo->pNext chain is not `NULL`, then the 2008 set of code:StdVideoH264SequenceParameterSet entries specified in 2009 pname:pParametersAddInfo->pStdSPSs are added first; 2010 ** If pname:pCreateInfo->videoSessionParametersTemplate is not 2011 dname:VK_NULL_HANDLE, then each code:StdVideoH264SequenceParameterSet 2012 entry stored in it is copied to the created video session parameters 2013 object if the created object does not already contain such an entry 2014 with the same pname:seq_parameter_set_id. 2015 * code:StdVideoH264PictureParameterSet structures representing 2016 <<encode-h264-pps,H.264 PPS>> entries, as follows: 2017 ** If the pname:pParametersAddInfo member of the 2018 slink:VkVideoEncodeH264SessionParametersCreateInfoKHR structure 2019 provided in the pname:pCreateInfo->pNext chain is not `NULL`, then the 2020 set of code:StdVideoH264PictureParameterSet entries specified in 2021 pname:pParametersAddInfo->pStdPPSs are added first; 2022 ** If pname:pCreateInfo->videoSessionParametersTemplate is not 2023 dname:VK_NULL_HANDLE, then each code:StdVideoH264PictureParameterSet 2024 entry stored in it is copied to the created video session parameters 2025 object if the created object does not already contain such an entry 2026 with the same pname:seq_parameter_set_id and 2027 pname:pic_parameter_set_id. 2028endif::VK_KHR_video_encode_h264[] 2029 2030ifdef::VK_KHR_video_encode_h265[] 2031If pname:pCreateInfo->videoSession was created with the video codec 2032operation ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, then the 2033created video session parameters object will initially contain the following 2034sets of parameter entries: 2035 2036 * code:StdVideoH265VideoParameterSet structures representing 2037 <<encode-h265-vps,H.265 VPS>> entries, as follows: 2038 ** If the pname:pParametersAddInfo member of the 2039 slink:VkVideoEncodeH265SessionParametersCreateInfoKHR structure 2040 provided in the pname:pCreateInfo->pNext chain is not `NULL`, then the 2041 set of code:StdVideoH265VideoParameterSet entries specified in 2042 pname:pParametersAddInfo->pStdVPSs are added first; 2043 ** If pname:pCreateInfo->videoSessionParametersTemplate is not 2044 dname:VK_NULL_HANDLE, then each code:StdVideoH265VideoParameterSet 2045 entry stored in it is copied to the created video session parameters 2046 object if the created object does not already contain such an entry 2047 with the same pname:vps_video_parameter_set_id. 2048 * code:StdVideoH265SequenceParameterSet structures representing 2049 <<encode-h265-sps,H.265 SPS>> entries, as follows: 2050 ** If the pname:pParametersAddInfo member of the 2051 slink:VkVideoEncodeH265SessionParametersCreateInfoKHR structure 2052 provided in the pname:pCreateInfo->pNext chain is not `NULL`, then the 2053 set of code:StdVideoH265SequenceParameterSet entries specified in 2054 pname:pParametersAddInfo->pStdSPSs are added first; 2055 ** If pname:pCreateInfo->videoSessionParametersTemplate is not 2056 dname:VK_NULL_HANDLE, then each code:StdVideoH265SequenceParameterSet 2057 entry stored in it is copied to the created video session parameters 2058 object if the created object does not already contain such an entry 2059 with the same pname:sps_video_parameter_set_id and 2060 pname:sps_seq_parameter_set_id. 2061 * code:StdVideoH265PictureParameterSet structures representing 2062 <<encode-h265-pps,H.265 PPS>> entries, as follows: 2063 ** If the pname:pParametersAddInfo member of the 2064 slink:VkVideoEncodeH265SessionParametersCreateInfoKHR structure 2065 provided in the pname:pCreateInfo->pNext chain is not `NULL`, then the 2066 set of code:StdVideoH265PictureParameterSet entries specified in 2067 pname:pParametersAddInfo->pStdPPSs are added first; 2068 ** If pname:pCreateInfo->videoSessionParametersTemplate is not 2069 dname:VK_NULL_HANDLE, then each code:StdVideoH265PictureParameterSet 2070 entry stored in it is copied to the created video session parameters 2071 object if the created object does not already contain such an entry 2072 with the same pname:sps_video_parameter_set_id, 2073 pname:pps_seq_parameter_set_id, and pname:pps_pic_parameter_set_id. 2074endif::VK_KHR_video_encode_h265[] 2075 2076ifdef::VK_KHR_video_encode_queue[] 2077In case of video session parameters objects created with a video encode 2078operation, implementations may: return the 2079ename:VK_ERROR_INVALID_VIDEO_STD_PARAMETERS_KHR error if any of the 2080specified Video Std parameters do not adhere to the syntactic or semantic 2081requirements of the used video compression standard, or if values derived 2082from parameters according to the rules defined by the used video compression 2083standard do not adhere to the capabilities of the video compression standard 2084or the implementation. 2085 2086[NOTE] 2087.Note 2088==== 2089Applications should: not rely on the 2090ename:VK_ERROR_INVALID_VIDEO_STD_PARAMETERS_KHR error being returned by any 2091command as a means to verify Video Std parameters, as implementations are 2092not required to report the error in any specific set of cases. 2093==== 2094endif::VK_KHR_video_encode_queue[] 2095 2096include::{generated}/validity/protos/vkCreateVideoSessionParametersKHR.adoc[] 2097-- 2098 2099[open,refpage='VkVideoSessionParametersCreateInfoKHR',desc='Structure specifying parameters of a newly created video session parameters object',type='structs'] 2100-- 2101The sname:VkVideoSessionParametersCreateInfoKHR structure is defined as: 2102 2103include::{generated}/api/structs/VkVideoSessionParametersCreateInfoKHR.adoc[] 2104 2105 * pname:sType is a elink:VkStructureType value identifying this structure. 2106 * pname:pNext is `NULL` or a pointer to a structure extending this 2107 structure. 2108 * pname:flags is reserved for future use. 2109 * pname:videoSessionParametersTemplate is dname:VK_NULL_HANDLE or a valid 2110 handle to a slink:VkVideoSessionParametersKHR object used as a template 2111 for constructing the new video session parameters object. 2112 * pname:videoSession is the video session object against which the video 2113 session parameters object is going to be created. 2114 2115Limiting values are defined below that are referenced by the relevant valid 2116usage statements of this structure. 2117 2118ifdef::VK_KHR_video_decode_h264[] 2119 * If pname:videoSession was created with the codec operation 2120 ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then let 2121 `StdVideoH264SequenceParameterSet spsAddList[]` be the list of 2122 <<decode-h264-sps,H.264 SPS>> entries to add to the created video 2123 session parameters object, defined as follows: 2124 ** If the pname:pParametersAddInfo member of the 2125 slink:VkVideoDecodeH264SessionParametersCreateInfoKHR structure 2126 provided in the pname:pNext chain is not `NULL`, then the set of 2127 code:StdVideoH264SequenceParameterSet entries specified in 2128 pname:pParametersAddInfo->pStdSPSs are added to pname:spsAddList; 2129 ** If pname:videoSessionParametersTemplate is not dname:VK_NULL_HANDLE, 2130 then each code:StdVideoH264SequenceParameterSet entry stored in it with 2131 pname:seq_parameter_set_id not matching any of the entries already in 2132 pname:spsAddList is added to pname:spsAddList. 2133 * If pname:videoSession was created with the codec operation 2134 ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then let 2135 `StdVideoH264PictureParameterSet ppsAddList[]` be the list of 2136 <<decode-h264-pps,H.264 PPS>> entries to add to the created video 2137 session parameters object, defined as follows: 2138 ** If the pname:pParametersAddInfo member of the 2139 slink:VkVideoDecodeH264SessionParametersCreateInfoKHR structure 2140 provided in the pname:pNext chain is not `NULL`, then the set of 2141 code:StdVideoH264PictureParameterSet entries specified in 2142 pname:pParametersAddInfo->pStdPPSs are added to pname:ppsAddList; 2143 ** If pname:videoSessionParametersTemplate is not dname:VK_NULL_HANDLE, 2144 then each code:StdVideoH264PictureParameterSet entry stored in it with 2145 pname:seq_parameter_set_id or pname:pic_parameter_set_id not matching 2146 any of the entries already in pname:ppsAddList is added to 2147 pname:ppsAddList. 2148endif::VK_KHR_video_decode_h264[] 2149ifdef::VK_KHR_video_decode_h265[] 2150 * If pname:videoSession was created with the codec operation 2151 ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then let 2152 `StdVideoH265VideoParameterSet vpsAddList[]` be the list of 2153 <<decode-h265-vps,H.265 VPS>> entries to add to the created video 2154 session parameters object, defined as follows: 2155 ** If the pname:pParametersAddInfo member of the 2156 slink:VkVideoDecodeH265SessionParametersCreateInfoKHR structure 2157 provided in the pname:pNext chain is not `NULL`, then the set of 2158 code:StdVideoH265VideoParameterSet entries specified in 2159 pname:pParametersAddInfo->pStdVPSs are added to pname:vpsAddList; 2160 ** If pname:videoSessionParametersTemplate is not dname:VK_NULL_HANDLE, 2161 then each code:StdVideoH265VideoParameterSet entry stored in it with 2162 pname:vps_video_parameter_set_id not matching any of the entries 2163 already in pname:vpsAddList is added to pname:vpsAddList. 2164 * If pname:videoSession was created with the codec operation 2165 ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then let 2166 `StdVideoH265SequenceParameterSet spsAddList[]` be the list of 2167 <<decode-h265-sps,H.265 SPS>> entries to add to the created video 2168 session parameters object, defined as follows: 2169 ** If the pname:pParametersAddInfo member of the 2170 slink:VkVideoDecodeH265SessionParametersCreateInfoKHR structure 2171 provided in the pname:pNext chain is not `NULL`, then the set of 2172 code:StdVideoH265SequenceParameterSet entries specified in 2173 pname:pParametersAddInfo->pStdSPSs are added to pname:spsAddList; 2174 ** If pname:videoSessionParametersTemplate is not dname:VK_NULL_HANDLE, 2175 then each code:StdVideoH265SequenceParameterSet entry stored in it with 2176 pname:sps_video_parameter_set_id or pname:sps_seq_parameter_set_id not 2177 matching any of the entries already in pname:spsAddList is added to 2178 pname:spsAddList. 2179 * If pname:videoSession was created with the codec operation 2180 ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then let 2181 `StdVideoH265PictureParameterSet ppsAddList[]` be the list of 2182 <<decode-h265-pps,H.265 PPS>> entries to add to the created video 2183 session parameters object, defined as follows: 2184 ** If the pname:pParametersAddInfo member of the 2185 slink:VkVideoDecodeH265SessionParametersCreateInfoKHR structure 2186 provided in the pname:pNext chain is not `NULL`, then the set of 2187 code:StdVideoH265PictureParameterSet entries specified in 2188 pname:pParametersAddInfo->pStdPPSs are added to pname:ppsAddList; 2189 ** If pname:videoSessionParametersTemplate is not dname:VK_NULL_HANDLE, 2190 then each code:StdVideoH265PictureParameterSet entry stored in it with 2191 pname:sps_video_parameter_set_id, pname:pps_seq_parameter_set_id, or 2192 pname:pps_pic_parameter_set_id not matching any of the entries already 2193 in pname:ppsAddList is added to pname:ppsAddList. 2194endif::VK_KHR_video_decode_h265[] 2195ifdef::VK_KHR_video_encode_queue[] 2196 * If pname:videoSession was created with an encode operation, then let 2197 `uint32_t qualityLevel` be the <<encode-quality-level,video encode 2198 quality level>> of the created video session parameters object, defined 2199 as follows: 2200 ** If the pname:pNext chain of this structure includes a 2201 slink:VkVideoEncodeQualityLevelInfoKHR structure, then 2202 pname:qualityLevel is equal to 2203 slink:VkVideoEncodeQualityLevelInfoKHR::pname:qualityLevel. 2204 ** Otherwise pname:qualityLevel is `0` 2205endif::VK_KHR_video_encode_queue[] 2206ifdef::VK_KHR_video_encode_h264[] 2207 * If pname:videoSession was created with the codec operation 2208 ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR, then let 2209 `StdVideoH264SequenceParameterSet spsAddList[]` be the list of 2210 <<encode-h264-sps,H.264 SPS>> entries to add to the created video 2211 session parameters object, defined as follows: 2212 ** If the pname:pParametersAddInfo member of the 2213 slink:VkVideoEncodeH264SessionParametersCreateInfoKHR structure 2214 provided in the pname:pNext chain is not `NULL`, then the set of 2215 code:StdVideoH264SequenceParameterSet entries specified in 2216 pname:pParametersAddInfo->pStdSPSs are added to pname:spsAddList; 2217 ** If pname:videoSessionParametersTemplate is not dname:VK_NULL_HANDLE, 2218 then each code:StdVideoH264SequenceParameterSet entry stored in it with 2219 pname:seq_parameter_set_id not matching any of the entries already in 2220 pname:spsAddList is added to pname:spsAddList. 2221 * If pname:videoSession was created with the codec operation 2222 ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR, then let 2223 `StdVideoH264PictureParameterSet ppsAddList[]` be the list of 2224 <<encode-h264-pps,H.264 PPS>> entries to add to the created video 2225 session parameters object, defined as follows: 2226 ** If the pname:pParametersAddInfo member of the 2227 slink:VkVideoEncodeH264SessionParametersCreateInfoKHR structure 2228 provided in the pname:pNext chain is not `NULL`, then the set of 2229 code:StdVideoH264PictureParameterSet entries specified in 2230 pname:pParametersAddInfo->pStdPPSs are added to pname:ppsAddList; 2231 ** If pname:videoSessionParametersTemplate is not dname:VK_NULL_HANDLE, 2232 then each code:StdVideoH264PictureParameterSet entry stored in it with 2233 pname:seq_parameter_set_id or pname:pic_parameter_set_id not matching 2234 any of the entries already in pname:ppsAddList is added to 2235 pname:ppsAddList. 2236endif::VK_KHR_video_encode_h264[] 2237ifdef::VK_KHR_video_encode_h265[] 2238 * If pname:videoSession was created with the codec operation 2239 ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, then let 2240 `StdVideoH265VideoParameterSet vpsAddList[]` be the list of 2241 <<encode-h265-vps,H.265 VPS>> entries to add to the created video 2242 session parameters object, defined as follows: 2243 ** If the pname:pParametersAddInfo member of the 2244 slink:VkVideoEncodeH265SessionParametersCreateInfoKHR structure 2245 provided in the pname:pNext chain is not `NULL`, then the set of 2246 code:StdVideoH265VideoParameterSet entries specified in 2247 pname:pParametersAddInfo->pStdVPSs are added to pname:vpsAddList; 2248 ** If pname:videoSessionParametersTemplate is not dname:VK_NULL_HANDLE, 2249 then each code:StdVideoH265VideoParameterSet entry stored in it with 2250 pname:vps_video_parameter_set_id not matching any of the entries 2251 already in pname:vpsAddList is added to pname:vpsAddList. 2252 * If pname:videoSession was created with the codec operation 2253 ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, then let 2254 `StdVideoH265SequenceParameterSet spsAddList[]` be the list of 2255 <<encode-h265-sps,H.265 SPS>> entries to add to the created video 2256 session parameters object, defined as follows: 2257 ** If the pname:pParametersAddInfo member of the 2258 slink:VkVideoEncodeH265SessionParametersCreateInfoKHR structure 2259 provided in the pname:pNext chain is not `NULL`, then the set of 2260 code:StdVideoH265SequenceParameterSet entries specified in 2261 pname:pParametersAddInfo->pStdSPSs are added to pname:spsAddList; 2262 ** If pname:videoSessionParametersTemplate is not dname:VK_NULL_HANDLE, 2263 then each code:StdVideoH265SequenceParameterSet entry stored in it with 2264 pname:sps_video_parameter_set_id or pname:sps_seq_parameter_set_id not 2265 matching any of the entries already in pname:spsAddList is added to 2266 pname:spsAddList. 2267 * If pname:videoSession was created with the codec operation 2268 ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, then let 2269 `StdVideoH265PictureParameterSet ppsAddList[]` be the list of 2270 <<encode-h265-pps,H.265 PPS>> entries to add to the created video 2271 session parameters object, defined as follows: 2272 ** If the pname:pParametersAddInfo member of the 2273 slink:VkVideoEncodeH265SessionParametersCreateInfoKHR structure 2274 provided in the pname:pNext chain is not `NULL`, then the set of 2275 code:StdVideoH265PictureParameterSet entries specified in 2276 pname:pParametersAddInfo->pStdPPSs are added to pname:ppsAddList; 2277 ** If pname:videoSessionParametersTemplate is not dname:VK_NULL_HANDLE, 2278 then each code:StdVideoH265PictureParameterSet entry stored in it with 2279 pname:sps_video_parameter_set_id, pname:pps_seq_parameter_set_id, or 2280 pname:pps_pic_parameter_set_id not matching any of the entries already 2281 in pname:ppsAddList is added to pname:ppsAddList. 2282endif::VK_KHR_video_encode_h265[] 2283 2284.Valid Usage 2285**** 2286 * [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSessionParametersTemplate-04855]] 2287 If pname:videoSessionParametersTemplate is not dname:VK_NULL_HANDLE, it 2288 must: have been created against pname:videoSession 2289ifdef::VK_KHR_video_encode_queue[] 2290 * [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSessionParametersTemplate-08310]] 2291 If pname:videoSessionParametersTemplate is not dname:VK_NULL_HANDLE and 2292 pname:videoSession was created with an encode operation, then 2293 pname:qualityLevel must: equal the <<encode-quality-level,video encode 2294 quality>> level pname:videoSessionParametersTemplate was created with 2295endif::VK_KHR_video_encode_queue[] 2296ifdef::VK_KHR_video_decode_h264[] 2297 * [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07203]] 2298 If pname:videoSession was created with the video codec operation 2299 ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then the pname:pNext 2300 chain must: include a 2301 slink:VkVideoDecodeH264SessionParametersCreateInfoKHR structure 2302 * [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07204]] 2303 If pname:videoSession was created with the video codec operation 2304 ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then the number of 2305 elements of pname:spsAddList must: be less than or equal to the 2306 pname:maxStdSPSCount specified in the 2307 slink:VkVideoDecodeH264SessionParametersCreateInfoKHR structure included 2308 in the pname:pNext chain 2309 * [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07205]] 2310 If pname:videoSession was created with the video codec operation 2311 ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then the number of 2312 elements of pname:ppsAddList must: be less than or equal to the 2313 pname:maxStdPPSCount specified in the 2314 slink:VkVideoDecodeH264SessionParametersCreateInfoKHR structure included 2315 in the pname:pNext chain 2316endif::VK_KHR_video_decode_h264[] 2317ifdef::VK_KHR_video_decode_h265[] 2318 * [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07206]] 2319 If pname:videoSession was created with the video codec operation 2320 ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then the pname:pNext 2321 chain must: include a 2322 slink:VkVideoDecodeH265SessionParametersCreateInfoKHR structure 2323 * [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07207]] 2324 If pname:videoSession was created with the video codec operation 2325 ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then the number of 2326 elements of pname:vpsAddList must: be less than or equal to the 2327 pname:maxStdVPSCount specified in the 2328 slink:VkVideoDecodeH265SessionParametersCreateInfoKHR structure included 2329 in the pname:pNext chain 2330 * [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07208]] 2331 If pname:videoSession was created with the video codec operation 2332 ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then the number of 2333 elements of pname:spsAddList must: be less than or equal to the 2334 pname:maxStdSPSCount specified in the 2335 slink:VkVideoDecodeH265SessionParametersCreateInfoKHR structure included 2336 in the pname:pNext chain 2337 * [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07209]] 2338 If pname:videoSession was created with the video codec operation 2339 ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then the number of 2340 elements of pname:ppsAddList must: be less than or equal to the 2341 pname:maxStdPPSCount specified in the 2342 slink:VkVideoDecodeH265SessionParametersCreateInfoKHR structure included 2343 in the pname:pNext chain 2344endif::VK_KHR_video_decode_h265[] 2345ifdef::VK_KHR_video_encode_h264[] 2346 * [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07210]] 2347 If pname:videoSession was created with the video codec operation 2348 ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR, then the pname:pNext 2349 chain must: include a 2350 slink:VkVideoEncodeH264SessionParametersCreateInfoKHR structure 2351 * [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-04839]] 2352 If pname:videoSession was created with the video codec operation 2353 ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR, then the number of 2354 elements of pname:spsAddList must: be less than or equal to the 2355 pname:maxStdSPSCount specified in the 2356 slink:VkVideoEncodeH264SessionParametersCreateInfoKHR structure included 2357 in the pname:pNext chain 2358 * [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-04840]] 2359 If pname:videoSession was created with the video codec operation 2360 ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR, then the number of 2361 elements of pname:ppsAddList must: be less than or equal to the 2362 pname:maxStdPPSCount specified in the 2363 slink:VkVideoEncodeH264SessionParametersCreateInfoKHR structure included 2364 in the pname:pNext chain 2365endif::VK_KHR_video_encode_h264[] 2366ifdef::VK_KHR_video_encode_h265[] 2367 * [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-07211]] 2368 If pname:videoSession was created with the video codec operation 2369 ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, then the pname:pNext 2370 chain must: include a 2371 slink:VkVideoEncodeH265SessionParametersCreateInfoKHR structure 2372 * [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-04841]] 2373 If pname:videoSession was created with the video codec operation 2374 ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, then the number of 2375 elements of pname:vpsAddList must: be less than or equal to the 2376 pname:maxStdVPSCount specified in the 2377 slink:VkVideoEncodeH265SessionParametersCreateInfoKHR structure included 2378 in the pname:pNext chain 2379 * [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-04842]] 2380 If pname:videoSession was created with the video codec operation 2381 ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, then the number of 2382 elements of pname:spsAddList must: be less than or equal to the 2383 pname:maxStdSPSCount specified in the 2384 slink:VkVideoEncodeH265SessionParametersCreateInfoKHR structure included 2385 in the pname:pNext chain 2386 * [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-04843]] 2387 If pname:videoSession was created with the video codec operation 2388 ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, then the number of 2389 elements of pname:ppsAddList must: be less than or equal to the 2390 pname:maxStdPPSCount specified in the 2391 slink:VkVideoEncodeH265SessionParametersCreateInfoKHR structure included 2392 in the pname:pNext chain 2393 * [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-08319]] 2394 If pname:videoSession was created with the video codec operation 2395 ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, then 2396 code:num_tile_columns_minus1 must: be less than 2397 slink:VkVideoEncodeH265CapabilitiesKHR::pname:maxTiles.width, as 2398 returned by flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video 2399 profile pname:videoSession was created with, for each element of 2400 pname:ppsAddList 2401 * [[VUID-VkVideoSessionParametersCreateInfoKHR-videoSession-08320]] 2402 If pname:videoSession was created with the video codec operation 2403 ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, then 2404 code:num_tile_rows_minus1 must: be less than 2405 slink:VkVideoEncodeH265CapabilitiesKHR::pname:maxTiles.height, as 2406 returned by flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video 2407 profile pname:videoSession was created with, for each element of 2408 pname:ppsAddList 2409endif::VK_KHR_video_encode_h265[] 2410**** 2411 2412include::{generated}/validity/structs/VkVideoSessionParametersCreateInfoKHR.adoc[] 2413-- 2414 2415[open,refpage='VkVideoSessionParametersCreateFlagsKHR',desc='Reserved for future use',type='flags'] 2416-- 2417include::{generated}/api/flags/VkVideoSessionParametersCreateFlagsKHR.adoc[] 2418 2419tname:VkVideoSessionParametersCreateFlagsKHR is a bitmask type for setting a 2420mask, but is currently reserved for future use. 2421-- 2422 2423 2424[[destroying-video-session-parameters]] 2425=== Destroying Video Session Parameters 2426 2427[open,refpage='vkDestroyVideoSessionParametersKHR',desc='Destroy video session parameters object',type='protos'] 2428-- 2429To destroy a video session parameters object, call: 2430 2431include::{generated}/api/protos/vkDestroyVideoSessionParametersKHR.adoc[] 2432 2433 * pname:device is the logical device that destroys the video session 2434 parameters object. 2435 * pname:videoSessionParameters is the video session parameters object to 2436 destroy. 2437 * pname:pAllocator controls host memory allocation as described in the 2438 <<memory-allocation, Memory Allocation>> chapter. 2439 2440.Valid Usage 2441**** 2442 * [[VUID-vkDestroyVideoSessionParametersKHR-videoSessionParameters-07212]] 2443 All submitted commands that refer to pname:videoSessionParameters must: 2444 have completed execution 2445 * [[VUID-vkDestroyVideoSessionParametersKHR-videoSessionParameters-07213]] 2446 If sname:VkAllocationCallbacks were provided when 2447 pname:videoSessionParameters was created, a compatible set of callbacks 2448 must: be provided here 2449 * [[VUID-vkDestroyVideoSessionParametersKHR-videoSessionParameters-07214]] 2450 If no sname:VkAllocationCallbacks were provided when 2451 pname:videoSessionParameters was created, pname:pAllocator must: be 2452 `NULL` 2453**** 2454 2455include::{generated}/validity/protos/vkDestroyVideoSessionParametersKHR.adoc[] 2456-- 2457 2458 2459[[video-session-parameters-update]] 2460=== Updating Video Session Parameters 2461 2462[open,refpage='vkUpdateVideoSessionParametersKHR',desc='Update video session parameters object',type='protos'] 2463-- 2464To update video session parameters object with new parameters, call: 2465 2466include::{generated}/api/protos/vkUpdateVideoSessionParametersKHR.adoc[] 2467 2468 * pname:device is the logical device that updates the video session 2469 parameters. 2470 * pname:videoSessionParameters is the video session parameters object to 2471 update. 2472 * pname:pUpdateInfo is a pointer to a 2473 slink:VkVideoSessionParametersUpdateInfoKHR structure specifying the 2474 parameter update information. 2475 2476After a successful call to this command, the 2477<<video-session-parameters,update sequence counter>> of 2478pname:videoSessionParameters is changed to the value specified in 2479pname:pUpdateInfo->updateSequenceCount. 2480 2481[NOTE] 2482.Note 2483==== 2484As each update issued to a video session parameters object needs to specify 2485the next available update sequence count value, concurrent updates of the 2486same video session parameters object are inherently disallowed. 2487However, recording video coding operations to command buffers referring to 2488parameters previously added to the video session parameters object is 2489allowed, even if there is a concurrent update in progress adding some new 2490entries to the object. 2491==== 2492 2493ifdef::VK_KHR_video_decode_h264[] 2494If pname:videoSessionParameters was created with the video codec operation 2495ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR and the 2496pname:pUpdateInfo->pNext chain includes a 2497slink:VkVideoDecodeH264SessionParametersAddInfoKHR structure, then this 2498command adds the following parameter entries to 2499pname:videoSessionParameters: 2500 2501 * The <<decode-h264-sps,H.264 SPS>> entries specified in 2502 slink:VkVideoDecodeH264SessionParametersAddInfoKHR::pname:pStdSPSs. 2503 * The <<decode-h264-pps,H.264 PPS>> entries specified in 2504 slink:VkVideoDecodeH264SessionParametersAddInfoKHR::pname:pStdPPSs. 2505endif::VK_KHR_video_decode_h264[] 2506 2507ifdef::VK_KHR_video_decode_h265[] 2508If pname:videoSessionParameters was created with the video codec operation 2509ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR and the 2510pname:pUpdateInfo->pNext chain includes a 2511slink:VkVideoDecodeH265SessionParametersAddInfoKHR structure, then this 2512command adds the following parameter entries to 2513pname:videoSessionParameters: 2514 2515 * The <<decode-h265-vps,H.265 VPS>> entries specified in 2516 slink:VkVideoDecodeH265SessionParametersAddInfoKHR::pname:pStdVPSs. 2517 * The <<decode-h265-sps,H.265 SPS>> entries specified in 2518 slink:VkVideoDecodeH265SessionParametersAddInfoKHR::pname:pStdSPSs. 2519 * The <<decode-h265-pps,H.265 PPS>> entries specified in 2520 slink:VkVideoDecodeH265SessionParametersAddInfoKHR::pname:pStdPPSs. 2521endif::VK_KHR_video_decode_h265[] 2522 2523ifdef::VK_KHR_video_encode_h264[] 2524If pname:videoSessionParameters was created with the video codec operation 2525ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR and the 2526pname:pUpdateInfo->pNext chain includes a 2527slink:VkVideoEncodeH264SessionParametersAddInfoKHR structure, then this 2528command adds the following parameter entries to 2529pname:videoSessionParameters: 2530 2531 * The <<encode-h264-sps,H.264 SPS>> entries specified in 2532 slink:VkVideoEncodeH264SessionParametersAddInfoKHR::pname:pStdSPSs. 2533 * The <<encode-h264-pps,H.264 PPS>> entries specified in 2534 slink:VkVideoEncodeH264SessionParametersAddInfoKHR::pname:pStdPPSs. 2535endif::VK_KHR_video_encode_h264[] 2536 2537ifdef::VK_KHR_video_encode_h265[] 2538If pname:videoSessionParameters was created with the video codec operation 2539ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR and the 2540pname:pUpdateInfo->pNext chain includes a 2541slink:VkVideoEncodeH265SessionParametersAddInfoKHR structure, then this 2542command adds the following parameter entries to 2543pname:videoSessionParameters: 2544 2545 * The <<encode-h265-vps,H.265 VPS>> entries specified in 2546 slink:VkVideoEncodeH265SessionParametersAddInfoKHR::pname:pStdVPSs. 2547 * The <<encode-h265-sps,H.265 SPS>> entries specified in 2548 slink:VkVideoEncodeH265SessionParametersAddInfoKHR::pname:pStdSPSs. 2549 * The <<encode-h265-pps,H.265 PPS>> entries specified in 2550 slink:VkVideoEncodeH265SessionParametersAddInfoKHR::pname:pStdPPSs. 2551endif::VK_KHR_video_encode_h265[] 2552 2553ifdef::VK_KHR_video_encode_queue[] 2554In case of video session parameters objects created with a video encode 2555operation, implementations may: return the 2556ename:VK_ERROR_INVALID_VIDEO_STD_PARAMETERS_KHR error if any of the 2557specified Video Std parameters do not adhere to the syntactic or semantic 2558requirements of the used video compression standard, or if values derived 2559from parameters according to the rules defined by the used video compression 2560standard do not adhere to the capabilities of the video compression standard 2561or the implementation. 2562 2563[NOTE] 2564.Note 2565==== 2566Applications should: not rely on the 2567ename:VK_ERROR_INVALID_VIDEO_STD_PARAMETERS_KHR error being returned by any 2568command as a means to verify Video Std parameters, as implementations are 2569not required to report the error in any specific set of cases. 2570==== 2571endif::VK_KHR_video_encode_queue[] 2572 2573.Valid Usage 2574**** 2575 * [[VUID-vkUpdateVideoSessionParametersKHR-pUpdateInfo-07215]] 2576 pname:pUpdateInfo->updateSequenceCount must: equal the current 2577 <<video-session-parameters,update sequence counter>> of 2578 pname:videoSessionParameters plus one 2579ifdef::VK_KHR_video_decode_h264[] 2580 * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07216]] 2581 If pname:videoSessionParameters was created with the video codec 2582 operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR and the 2583 pname:pNext chain of pname:pUpdateInfo includes a 2584 slink:VkVideoDecodeH264SessionParametersAddInfoKHR structure, then 2585 pname:videoSessionParameters must: not already contain a 2586 code:StdVideoH264SequenceParameterSet entry with 2587 pname:seq_parameter_set_id matching any of the elements of 2588 slink:VkVideoDecodeH264SessionParametersAddInfoKHR::pname:pStdSPSs 2589 * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07217]] 2590 If pname:videoSessionParameters was created with the video codec 2591 operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then the 2592 number of code:StdVideoH264SequenceParameterSet entries already stored 2593 in it plus the value of the pname:stdSPSCount member of the 2594 slink:VkVideoDecodeH264SessionParametersAddInfoKHR structure included in 2595 the pname:pUpdateInfo->pNext chain must: be less than or equal to the 2596 slink:VkVideoDecodeH264SessionParametersCreateInfoKHR::pname:maxStdSPSCount 2597 pname:videoSessionParameters was created with 2598 * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07218]] 2599 If pname:videoSessionParameters was created with the video codec 2600 operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR and the 2601 pname:pNext chain of pname:pUpdateInfo includes a 2602 slink:VkVideoDecodeH264SessionParametersAddInfoKHR structure, then 2603 pname:videoSessionParameters must: not already contain a 2604 code:StdVideoH264PictureParameterSet entry with both 2605 pname:seq_parameter_set_id and pname:pic_parameter_set_id matching any 2606 of the elements of 2607 slink:VkVideoDecodeH264SessionParametersAddInfoKHR::pname:pStdPPSs 2608 * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07219]] 2609 If pname:videoSessionParameters was created with the video codec 2610 operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then the 2611 number of code:StdVideoH264PictureParameterSet entries already stored in 2612 it plus the value of the pname:stdPPSCount member of the 2613 slink:VkVideoDecodeH264SessionParametersAddInfoKHR structure included in 2614 the pname:pUpdateInfo->pNext chain must: be less than or equal to the 2615 slink:VkVideoDecodeH264SessionParametersCreateInfoKHR::pname:maxStdPPSCount 2616 pname:videoSessionParameters was created with 2617endif::VK_KHR_video_decode_h264[] 2618ifdef::VK_KHR_video_decode_h265[] 2619 * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07220]] 2620 If pname:videoSessionParameters was created with the video codec 2621 operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR and the 2622 pname:pNext chain of pname:pUpdateInfo includes a 2623 slink:VkVideoDecodeH265SessionParametersAddInfoKHR structure, then 2624 pname:videoSessionParameters must: not already contain a 2625 code:StdVideoH265VideoParameterSet entry with 2626 pname:vps_video_parameter_set_id matching any of the elements of 2627 slink:VkVideoDecodeH265SessionParametersAddInfoKHR::pname:pStdVPSs 2628 * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07221]] 2629 If pname:videoSessionParameters was created with the video codec 2630 operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then the 2631 number of code:StdVideoH265VideoParameterSet entries already stored in 2632 it plus the value of the pname:stdVPSCount member of the 2633 slink:VkVideoDecodeH265SessionParametersAddInfoKHR structure included in 2634 the pname:pUpdateInfo->pNext chain must: be less than or equal to the 2635 slink:VkVideoDecodeH265SessionParametersCreateInfoKHR::pname:maxStdVPSCount 2636 pname:videoSessionParameters was created with 2637 * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07222]] 2638 If pname:videoSessionParameters was created with the video codec 2639 operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR and the 2640 pname:pNext chain of pname:pUpdateInfo includes a 2641 slink:VkVideoDecodeH265SessionParametersAddInfoKHR structure, then 2642 pname:videoSessionParameters must: not already contain a 2643 code:StdVideoH265SequenceParameterSet entry with both 2644 pname:sps_video_parameter_set_id and pname:sps_seq_parameter_set_id 2645 matching any of the elements of 2646 slink:VkVideoDecodeH265SessionParametersAddInfoKHR::pname:pStdSPSs 2647 * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07223]] 2648 If pname:videoSessionParameters was created with the video codec 2649 operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then the 2650 number of code:StdVideoH265SequenceParameterSet entries already stored 2651 in it plus the value of the pname:stdSPSCount member of the 2652 slink:VkVideoDecodeH265SessionParametersAddInfoKHR structure included in 2653 the pname:pUpdateInfo->pNext chain must: be less than or equal to the 2654 slink:VkVideoDecodeH265SessionParametersCreateInfoKHR::pname:maxStdSPSCount 2655 pname:videoSessionParameters was created with 2656 * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07224]] 2657 If pname:videoSessionParameters was created with the video codec 2658 operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR and the 2659 pname:pNext chain of pname:pUpdateInfo includes a 2660 slink:VkVideoDecodeH265SessionParametersAddInfoKHR structure, then 2661 pname:videoSessionParameters must: not already contain a 2662 code:StdVideoH265PictureParameterSet entry with 2663 pname:sps_video_parameter_set_id, pname:pps_seq_parameter_set_id, and 2664 pname:pps_pic_parameter_set_id all matching any of the elements of 2665 slink:VkVideoDecodeH265SessionParametersAddInfoKHR::pname:pStdPPSs 2666 * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07225]] 2667 If pname:videoSessionParameters was created with the video codec 2668 operation ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then the 2669 number of code:StdVideoH265PictureParameterSet entries already stored in 2670 it plus the value of the pname:stdPPSCount member of the 2671 slink:VkVideoDecodeH265SessionParametersAddInfoKHR structure included in 2672 the pname:pUpdateInfo->pNext chain must: be less than or equal to the 2673 slink:VkVideoDecodeH265SessionParametersCreateInfoKHR::pname:maxStdPPSCount 2674 pname:videoSessionParameters was created with 2675endif::VK_KHR_video_decode_h265[] 2676ifdef::VK_KHR_video_encode_h264[] 2677 * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07226]] 2678 If pname:videoSessionParameters was created with the video codec 2679 operation ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR and the 2680 pname:pNext chain of pname:pUpdateInfo includes a 2681 slink:VkVideoEncodeH264SessionParametersAddInfoKHR structure, then 2682 pname:videoSessionParameters must: not already contain a 2683 code:StdVideoH264SequenceParameterSet entry with 2684 pname:seq_parameter_set_id matching any of the elements of 2685 slink:VkVideoEncodeH264SessionParametersAddInfoKHR::pname:pStdSPSs 2686 * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-06441]] 2687 If pname:videoSessionParameters was created with the video codec 2688 operation ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR, then the 2689 number of code:StdVideoH264SequenceParameterSet entries already stored 2690 in it plus the value of the pname:stdSPSCount member of the 2691 slink:VkVideoEncodeH264SessionParametersAddInfoKHR structure included in 2692 the pname:pUpdateInfo->pNext chain must: be less than or equal to the 2693 slink:VkVideoEncodeH264SessionParametersCreateInfoKHR::pname:maxStdSPSCount 2694 pname:videoSessionParameters was created with 2695 * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07227]] 2696 If pname:videoSessionParameters was created with the video codec 2697 operation ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR and the 2698 pname:pNext chain of pname:pUpdateInfo includes a 2699 slink:VkVideoEncodeH264SessionParametersAddInfoKHR structure, then 2700 pname:videoSessionParameters must: not already contain a 2701 code:StdVideoH264PictureParameterSet entry with both 2702 pname:seq_parameter_set_id and pname:pic_parameter_set_id matching any 2703 of the elements of 2704 slink:VkVideoEncodeH264SessionParametersAddInfoKHR::pname:pStdPPSs 2705 * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-06442]] 2706 If pname:videoSessionParameters was created with the video codec 2707 operation ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR, then the 2708 number of code:StdVideoH264PictureParameterSet entries already stored in 2709 it plus the value of the pname:stdPPSCount member of the 2710 slink:VkVideoEncodeH264SessionParametersAddInfoKHR structure included in 2711 the pname:pUpdateInfo->pNext chain must: be less than or equal to the 2712 slink:VkVideoEncodeH264SessionParametersCreateInfoKHR::pname:maxStdPPSCount 2713 pname:videoSessionParameters was created with 2714endif::VK_KHR_video_encode_h264[] 2715ifdef::VK_KHR_video_encode_h265[] 2716 * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07228]] 2717 If pname:videoSessionParameters was created with the video codec 2718 operation ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR and the 2719 pname:pNext chain of pname:pUpdateInfo includes a 2720 slink:VkVideoEncodeH265SessionParametersAddInfoKHR structure, then 2721 pname:videoSessionParameters must: not already contain a 2722 code:StdVideoH265VideoParameterSet entry with 2723 pname:vps_video_parameter_set_id matching any of the elements of 2724 slink:VkVideoEncodeH265SessionParametersAddInfoKHR::pname:pStdVPSs 2725 * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-06443]] 2726 If pname:videoSessionParameters was created with the video codec 2727 operation ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, then the 2728 number of code:StdVideoH265VideoParameterSet entries already stored in 2729 it plus the value of the pname:stdVPSCount member of the 2730 slink:VkVideoEncodeH265SessionParametersAddInfoKHR structure included in 2731 the pname:pUpdateInfo->pNext chain must: be less than or equal to the 2732 slink:VkVideoEncodeH265SessionParametersCreateInfoKHR::pname:maxStdVPSCount 2733 pname:videoSessionParameters was created with 2734 * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07229]] 2735 If pname:videoSessionParameters was created with the video codec 2736 operation ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR and the 2737 pname:pNext chain of pname:pUpdateInfo includes a 2738 slink:VkVideoEncodeH265SessionParametersAddInfoKHR structure, then 2739 pname:videoSessionParameters must: not already contain a 2740 code:StdVideoH265SequenceParameterSet entry with both 2741 pname:sps_video_parameter_set_id and pname:sps_seq_parameter_set_id 2742 matching any of the elements of 2743 slink:VkVideoEncodeH265SessionParametersAddInfoKHR::pname:pStdSPSs 2744 * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-06444]] 2745 If pname:videoSessionParameters was created with the video codec 2746 operation ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, then the 2747 number of code:StdVideoH265SequenceParameterSet entries already stored 2748 in it plus the value of the pname:stdSPSCount member of the 2749 slink:VkVideoEncodeH265SessionParametersAddInfoKHR structure included in 2750 the pname:pUpdateInfo->pNext chain must: be less than or equal to the 2751 slink:VkVideoEncodeH265SessionParametersCreateInfoKHR::pname:maxStdSPSCount 2752 pname:videoSessionParameters was created with 2753 * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-07230]] 2754 If pname:videoSessionParameters was created with the video codec 2755 operation ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR and the 2756 pname:pNext chain of pname:pUpdateInfo includes a 2757 slink:VkVideoEncodeH265SessionParametersAddInfoKHR structure, then 2758 pname:videoSessionParameters must: not already contain a 2759 code:StdVideoH265PictureParameterSet entry with 2760 pname:sps_video_parameter_set_id, pname:pps_seq_parameter_set_id, and 2761 pname:pps_pic_parameter_set_id all matching any of the elements of 2762 slink:VkVideoEncodeH265SessionParametersAddInfoKHR::pname:pStdPPSs 2763 * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-06445]] 2764 If pname:videoSessionParameters was created with the video codec 2765 operation ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, then the 2766 number of code:StdVideoH265PictureParameterSet entries already stored in 2767 it plus the value of the pname:stdPPSCount member of the 2768 slink:VkVideoEncodeH265SessionParametersAddInfoKHR structure included in 2769 the pname:pUpdateInfo->pNext chain must: be less than or equal to the 2770 slink:VkVideoEncodeH265SessionParametersCreateInfoKHR::pname:maxStdPPSCount 2771 pname:videoSessionParameters was created with 2772 * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-08321]] 2773 If pname:videoSessionParameters was created with the video codec 2774 operation ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR and the 2775 pname:pNext chain of pname:pUpdateInfo includes a 2776 slink:VkVideoEncodeH265SessionParametersAddInfoKHR structure, then 2777 code:num_tile_columns_minus1 must: be less than 2778 slink:VkVideoEncodeH265CapabilitiesKHR::pname:maxTiles.width, as 2779 returned by flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video 2780 profile pname:videoSessionParameters was created with, for each element 2781 of slink:VkVideoEncodeH265SessionParametersAddInfoKHR::pname:pStdPPSs 2782 * [[VUID-vkUpdateVideoSessionParametersKHR-videoSessionParameters-08322]] 2783 If pname:videoSessionParameters was created with the video codec 2784 operation ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR and the 2785 pname:pNext chain of pname:pUpdateInfo includes a 2786 slink:VkVideoEncodeH265SessionParametersAddInfoKHR structure, then 2787 code:num_tile_rows_minus1 must: be less than 2788 slink:VkVideoEncodeH265CapabilitiesKHR::pname:maxTiles.height, as 2789 returned by flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video 2790 profile pname:videoSessionParameters was created with, for each element 2791 of slink:VkVideoEncodeH265SessionParametersAddInfoKHR::pname:pStdPPSs 2792endif::VK_KHR_video_encode_h265[] 2793**** 2794 2795include::{generated}/validity/protos/vkUpdateVideoSessionParametersKHR.adoc[] 2796-- 2797 2798[open,refpage='VkVideoSessionParametersUpdateInfoKHR',desc='Structure specifying video session parameters update information',type='structs'] 2799-- 2800The sname:VkVideoSessionParametersUpdateInfoKHR structure is defined as: 2801 2802include::{generated}/api/structs/VkVideoSessionParametersUpdateInfoKHR.adoc[] 2803 2804 * pname:sType is a elink:VkStructureType value identifying this structure. 2805 * pname:pNext is `NULL` or a pointer to a structure extending this 2806 structure. 2807 * pname:updateSequenceCount is the new <<video-session-parameters,update 2808 sequence count>> to set for the video session parameters object. 2809 2810include::{generated}/validity/structs/VkVideoSessionParametersUpdateInfoKHR.adoc[] 2811-- 2812 2813 2814[[video-coding-scope]] 2815== Video Coding Scope 2816 2817Applications can: record video coding commands for a video session only 2818within a video coding scope. 2819 2820[open,refpage='vkCmdBeginVideoCodingKHR',desc='Begin video coding scope',type='protos'] 2821-- 2822To begin a video coding scope, call: 2823 2824include::{generated}/api/protos/vkCmdBeginVideoCodingKHR.adoc[] 2825 2826 * pname:commandBuffer is the command buffer in which to record the 2827 command. 2828 * pname:pBeginInfo is a pointer to a slink:VkVideoBeginCodingInfoKHR 2829 structure specifying the parameters of the video coding scope, including 2830 the video session and video session parameters object to use. 2831 2832After beginning a video coding scope, the video session object specified in 2833pname:pBeginInfo->videoSession is _bound_ to the command buffer, and the 2834command buffer is ready to record video coding operations. 2835Similarly, if pname:pBeginInfo->videoSessionParameters is not 2836dname:VK_NULL_HANDLE, it is also _bound_ to the command buffer, and video 2837coding operations can: refer to the codec-specific parameters stored in it. 2838 2839[[bound-reference-picture-resources]] 2840This command also establishes the set of _bound reference picture resources_ 2841that can: be used as <<reconstructed-picture,reconstructed pictures>> or 2842<<reference-picture,reference pictures>> within the video coding scope. 2843Each element of this set consists of a <<video-picture-resources,video 2844picture resource>> and the <<dpb-slot,DPB slot>> index associated with it, 2845if there is one. 2846 2847The set of bound reference picture resources is immutable within a video 2848coding scope, however, the DPB slot index associated with any of the bound 2849reference picture resources can: change during the video coding scope in 2850response to video coding operations. 2851 2852The slink:VkVideoReferenceSlotInfoKHR structures provided as the elements of 2853pname:pBeginInfo->pReferenceSlots are interpreted by this command as 2854follows: 2855 2856 * If pname:slotIndex is non-negative and pname:pPictureResource is not 2857 `NULL`, then the <<video-picture-resources,video picture resource>> 2858 defined by the slink:VkVideoPictureResourceInfoKHR structure pointed to 2859 by pname:pPictureResource is added to the set of bound reference picture 2860 resources and is associated with the DPB slot index specified in 2861 pname:slotIndex. 2862 * If pname:slotIndex is non-negative and pname:pPictureResource is `NULL`, 2863 then the DPB slot with index pname:slotIndex is <<dpb-slot-states, 2864 deactivated>> by this command. 2865 * If pname:slotIndex is negative and pname:pPictureResource is not `NULL`, 2866 then the <<video-picture-resources,video picture resource>> defined by 2867 the slink:VkVideoPictureResourceInfoKHR structure pointed to by 2868 pname:pPictureResource is added to the set of bound reference picture 2869 resources without an associated DPB slot. 2870 Such a picture resource can: be subsequently used as a 2871 <<reconstructed-picture,reconstructed picture>> to associate it with a 2872 DPB slot. 2873 * If pname:slotIndex is negative and pname:pPictureResource is `NULL`, 2874 then the element is ignored. 2875 2876ifdef::VK_KHR_video_decode_h264[] 2877[NOTE] 2878.Note 2879==== 2880It is possible for multiple bound reference picture resources to be 2881associated with the same DPB slot index, or for a single bound reference 2882picture to refer to multiple separate reference pictures. 2883For example, in case of an <<decode-h264-profile,H.264 decode profile>> with 2884<<decode-h264-interlaced-support,interlaced frame support>> a single DPB 2885slot can refer to two separate pictures for the top and bottom fields. 2886Depending on the picture layout used by the <<decode-h264-profile,H.264 2887decode profile>>, the following special cases may: arise: 2888 2889 * If the picture layout is 2890 ename:VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_INTERLACED_INTERLEAVED_LINES_BIT_KHR, 2891 then the top and bottom field pictures are physically co-located in the 2892 same video picture resource with even scanlines corresponding to the top 2893 field and odd scanlines corresponding to the bottom field, respectively. 2894 * If the picture layout is 2895 ename:VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_INTERLACED_SEPARATE_PLANES_BIT_KHR, 2896 then the top and bottom field pictures are stored in separate video 2897 picture resources (in separate subregions of the same image layer, in 2898 separate layers of the same image, or in entirely separate images), 2899 hence two elements of 2900 slink:VkVideoBeginCodingInfoKHR::pname:pReferenceSlots can: contain the 2901 same pname:slotIndex but specify different video picture resources in 2902 their pname:pPictureResource members. 2903 2904==== 2905endif::VK_KHR_video_decode_h264[] 2906 2907All non-negative pname:slotIndex values specified in the elements of 2908pname:pBeginInfo->pReferenceSlots must: identify DPB slots of the video 2909session that are in the <<dpb-slot-states,active state>> at the time this 2910command is executed on the device. 2911 2912[NOTE] 2913.Note 2914==== 2915The application does not have to specify an entry in 2916pname:pBeginInfo->pReferenceSlots corresponding to all active DPB slots of 2917the video session, but only for those which are intended to be used in the 2918video coding scope. 2919This way the application can avoid any potential runtime cost associated 2920with binding the corresponding picture resources to the command buffer. 2921==== 2922 2923ifdef::VK_KHR_video_encode_queue[] 2924In case of a video encode session, the application is also responsible for 2925providing information about the current <<encode-rate-control-state,rate 2926control state>> configured for the video session by including an instance of 2927the slink:VkVideoEncodeRateControlInfoKHR structure in the pname:pNext chain 2928of pname:pBeginInfo. 2929If no slink:VkVideoEncodeRateControlInfoKHR is included, then the presence 2930of an empty slink:VkVideoEncodeRateControlInfoKHR structure is implied which 2931indicates that the current <<encode-rate-control-modes,rate control mode>> 2932is ename:VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DEFAULT_KHR. 2933The specified state must: <<encode-rate-control-state-matching,match>> the 2934effective rate control state configured for the video session at the time 2935the recorded command is executed on the device. 2936 2937[NOTE] 2938.Note 2939==== 2940Including an instance of the slink:VkVideoEncodeRateControlInfoKHR structure 2941in the pname:pNext chain of pname:pBeginInfo does not change the rate 2942control state configured for the video session, but only specifies the 2943expected rate control state configured at the time the recorded command is 2944executed on the device which allows the implementation to have information 2945about the configured rate control state at command buffer recording time. 2946In order to change the current rate control state of a video session, the 2947application has to issue an appropriate flink:vkCmdControlVideoCodingKHR 2948command as described in the <<video-coding-control,Video Coding Control>> 2949and <<encode-rate-control-state,Rate Control State>> sections. 2950==== 2951endif::VK_KHR_video_encode_queue[] 2952 2953.Valid Usage 2954**** 2955 * [[VUID-vkCmdBeginVideoCodingKHR-commandBuffer-07231]] 2956 The sname:VkCommandPool that pname:commandBuffer was allocated from 2957 must: support the video codec operation pname:pBeginInfo->videoSession 2958 was created with, as returned by 2959 flink:vkGetPhysicalDeviceQueueFamilyProperties2 in 2960 slink:VkQueueFamilyVideoPropertiesKHR::pname:videoCodecOperations 2961 * [[VUID-vkCmdBeginVideoCodingKHR-None-07232]] 2962 There must: be no <<queries-operation-active,active>> queries 2963 * [[VUID-vkCmdBeginVideoCodingKHR-commandBuffer-07233]] 2964 If pname:commandBuffer is an unprotected command buffer and 2965 <<limits-protectedNoFault, pname:protectedNoFault>> is not supported, 2966 then pname:pBeginInfo->videoSession must: not have been created with 2967 ename:VK_VIDEO_SESSION_CREATE_PROTECTED_CONTENT_BIT_KHR 2968 * [[VUID-vkCmdBeginVideoCodingKHR-commandBuffer-07234]] 2969 If pname:commandBuffer is a protected command buffer and 2970 <<limits-protectedNoFault, pname:protectedNoFault>> is not supported, 2971 then pname:pBeginInfo->videoSession must: have been created with 2972 ename:VK_VIDEO_SESSION_CREATE_PROTECTED_CONTENT_BIT_KHR 2973 * [[VUID-vkCmdBeginVideoCodingKHR-commandBuffer-07235]] 2974 If pname:commandBuffer is an unprotected command buffer, 2975 <<limits-protectedNoFault, pname:protectedNoFault>> is not supported, 2976 and the pname:pPictureResource member of any element of 2977 pname:pBeginInfo->pReferenceSlots is not `NULL`, then 2978 pname:pPictureResource->imageViewBinding for that element must: not 2979 specify an image view created from a protected image 2980 * [[VUID-vkCmdBeginVideoCodingKHR-commandBuffer-07236]] 2981 If pname:commandBuffer is a protected command buffer 2982 <<limits-protectedNoFault, pname:protectedNoFault>> is not supported, 2983 and the pname:pPictureResource member of any element of 2984 pname:pBeginInfo->pReferenceSlots is not `NULL`, then 2985 pname:pPictureResource->imageViewBinding for that element must: specify 2986 an image view created from a protected image 2987 * [[VUID-vkCmdBeginVideoCodingKHR-slotIndex-07239]] 2988 If the pname:slotIndex member of any element of 2989 pname:pBeginInfo->pReferenceSlots is not negative, then it must: specify 2990 the index of a DPB slot that is in the <<dpb-slot-states,active state>> 2991 in pname:pBeginInfo->videoSession at the time the command is executed on 2992 the device 2993 * [[VUID-vkCmdBeginVideoCodingKHR-pPictureResource-07265]] 2994 Each video picture resource specified by any non-`NULL` 2995 pname:pPictureResource member specified in the elements of 2996 pname:pBeginInfo->pReferenceSlots for which pname:slotIndex is not 2997 negative must: <<video-picture-resource-matching,match>> one of the 2998 video picture resources currently associated with the DPB slot index of 2999 pname:pBeginInfo->videoSession specified by pname:slotIndex at the time 3000 the command is executed on the device 3001ifdef::VK_KHR_video_encode_queue[] 3002 * [[VUID-vkCmdBeginVideoCodingKHR-pBeginInfo-08253]] 3003 If pname:pBeginInfo->videoSession was created with a video encode 3004 operation and the pname:pNext chain of pname:pBeginInfo does not include 3005 an instance of the slink:VkVideoEncodeRateControlInfoKHR structure, then 3006 the <<encode-rate-control-modes,rate control mode>> configured for 3007 pname:pBeginInfo->videoSession at the time the command is executed on 3008 the device must: be ename:VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DEFAULT_KHR 3009 * [[VUID-vkCmdBeginVideoCodingKHR-pBeginInfo-08254]] 3010 If pname:pBeginInfo->videoSession was created with a video encode 3011 operation and the pname:pNext chain of pname:pBeginInfo includes an 3012 instance of the slink:VkVideoEncodeRateControlInfoKHR structure, then it 3013 must: <<encode-rate-control-state-matching,match>> the rate control 3014 state configured for pname:pBeginInfo->videoSession at the time the 3015 command is executed on the device 3016endif::VK_KHR_video_encode_queue[] 3017ifdef::VK_KHR_video_encode_h264[] 3018 * [[VUID-vkCmdBeginVideoCodingKHR-pBeginInfo-08255]] 3019 If pname:pBeginInfo->videoSession was created with the video codec 3020 operation ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR, the 3021 current <<encode-rate-control-modes,rate control mode>> is not 3022 ename:VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DEFAULT_KHR or 3023 ename:VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DISABLED_BIT_KHR, and 3024 slink:VkVideoEncodeH264CapabilitiesKHR::pname:requiresGopRemainingFrames 3025 is ename:VK_TRUE, as returned by 3026 flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video profile the 3027 pname:pBeginInfo->videoSession was created with, then the pname:pNext 3028 chain of pname:pBeginInfo must: include an instance of the 3029 slink:VkVideoEncodeH264GopRemainingFrameInfoKHR with its 3030 pname:useGopRemainingFrames member set to ename:VK_TRUE 3031endif::VK_KHR_video_encode_h264[] 3032ifdef::VK_KHR_video_encode_h265[] 3033 * [[VUID-vkCmdBeginVideoCodingKHR-pBeginInfo-08256]] 3034 If pname:pBeginInfo->videoSession was created with the video codec 3035 operation ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, the 3036 current <<encode-rate-control-modes,rate control mode>> is not 3037 ename:VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DEFAULT_KHR or 3038 ename:VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DISABLED_BIT_KHR, and 3039 slink:VkVideoEncodeH265CapabilitiesKHR::pname:requiresGopRemainingFrames 3040 is ename:VK_TRUE, as returned by 3041 flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video profile the 3042 pname:pBeginInfo->videoSession was created with, then the pname:pNext 3043 chain of pname:pBeginInfo must: include an instance of the 3044 slink:VkVideoEncodeH265GopRemainingFrameInfoKHR with its 3045 pname:useGopRemainingFrames member set to ename:VK_TRUE 3046endif::VK_KHR_video_encode_h265[] 3047**** 3048 3049include::{generated}/validity/protos/vkCmdBeginVideoCodingKHR.adoc[] 3050-- 3051 3052[open,refpage='VkVideoBeginCodingInfoKHR',desc='Structure specifying video coding scope begin information',type='structs'] 3053-- 3054The slink:VkVideoBeginCodingInfoKHR structure is defined as: 3055 3056include::{generated}/api/structs/VkVideoBeginCodingInfoKHR.adoc[] 3057 3058 * pname:sType is a elink:VkStructureType value identifying this structure. 3059 * pname:pNext is `NULL` or a pointer to a structure extending this 3060 structure. 3061 * pname:flags is reserved for future use. 3062 * pname:videoSession is the video session object to be bound for the 3063 processing of the video commands. 3064 * pname:videoSessionParameters is dname:VK_NULL_HANDLE or a handle of a 3065 slink:VkVideoSessionParametersKHR object to be used for the processing 3066 of the video commands. 3067 If dname:VK_NULL_HANDLE, then no video session parameters object is 3068 bound for the duration of the video coding scope. 3069 * pname:referenceSlotCount is the number of elements in the 3070 pname:pReferenceSlots array. 3071 * pname:pReferenceSlots is a pointer to an array of 3072 slink:VkVideoReferenceSlotInfoKHR structures specifying the information 3073 used to determine the set of <<bound-reference-picture-resources,bound 3074 reference picture resources>> for the video coding scope and their 3075 initial association with <<dpb-slot,DPB slot>> indices. 3076 3077Limiting values are defined below that are referenced by the relevant valid 3078usage statements of this structure. 3079 3080 * Let `VkOffset2D codedOffsetGranularity` be the minimum alignment 3081 requirement for the coded offset of video picture resources. 3082 Unless otherwise defined, the value of the pname:x and pname:y members 3083 of pname:codedOffsetGranularity are `0`. 3084ifdef::VK_KHR_video_decode_h264[] 3085 ** If pname:videoSession was created with an <<decode-h264-profile,H.264 3086 decode profile>> with a 3087 slink:VkVideoDecodeH264ProfileInfoKHR::pname:pictureLayout of 3088 ename:VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_INTERLACED_SEPARATE_PLANES_BIT_KHR, 3089 then pname:codedOffsetGranularity is equal to 3090 slink:VkVideoDecodeH264CapabilitiesKHR::pname:fieldOffsetGranularity, 3091 as returned by flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for that 3092 video profile. 3093endif::VK_KHR_video_decode_h264[] 3094 3095.Valid Usage 3096**** 3097 * [[VUID-VkVideoBeginCodingInfoKHR-videoSession-07237]] 3098 pname:videoSession must: have memory bound to all of its memory bindings 3099 returned by flink:vkGetVideoSessionMemoryRequirementsKHR for 3100 pname:videoSession 3101 * [[VUID-VkVideoBeginCodingInfoKHR-slotIndex-04856]] 3102 Each non-negative slink:VkVideoReferenceSlotInfoKHR::pname:slotIndex 3103 specified in the elements of pname:pReferenceSlots must: be less than 3104 the slink:VkVideoSessionCreateInfoKHR::pname:maxDpbSlots specified when 3105 pname:videoSession was created 3106 * [[VUID-VkVideoBeginCodingInfoKHR-pPictureResource-07238]] 3107 Each video picture resource corresponding to any non-`NULL` 3108 pname:pPictureResource member specified in the elements of 3109 pname:pReferenceSlots must: be <<video-picture-resource-uniqueness, 3110 unique>> within pname:pReferenceSlots 3111 * [[VUID-VkVideoBeginCodingInfoKHR-pPictureResource-07240]] 3112 If the pname:pPictureResource member of any element of 3113 pname:pReferenceSlots is not `NULL`, then the image view specified in 3114 pname:pPictureResource->imageViewBinding for that element must: be 3115 <<video-profile-compatibility,compatible>> with the video profile 3116 pname:videoSession was created with 3117 * [[VUID-VkVideoBeginCodingInfoKHR-pPictureResource-07241]] 3118 If the pname:pPictureResource member of any element of 3119 pname:pReferenceSlots is not `NULL`, then the format of the image view 3120 specified in pname:pPictureResource->imageViewBinding for that element 3121 must: match the 3122 slink:VkVideoSessionCreateInfoKHR::pname:referencePictureFormat 3123 pname:videoSession was created with 3124 * [[VUID-VkVideoBeginCodingInfoKHR-pPictureResource-07242]] 3125 If the pname:pPictureResource member of any element of 3126 pname:pReferenceSlots is not `NULL`, then its pname:codedOffset member 3127 must: be an integer multiple of pname:codedOffsetGranularity 3128 * [[VUID-VkVideoBeginCodingInfoKHR-pPictureResource-07243]] 3129 If the pname:pPictureResource member of any element of 3130 pname:pReferenceSlots is not `NULL`, then its pname:codedExtent member 3131 must: be between pname:minCodedExtent and pname:maxCodedExtent, 3132 inclusive, pname:videoSession was created with 3133 * [[VUID-VkVideoBeginCodingInfoKHR-flags-07244]] 3134 If slink:VkVideoCapabilitiesKHR::pname:flags does not include 3135 ename:VK_VIDEO_CAPABILITY_SEPARATE_REFERENCE_IMAGES_BIT_KHR, as returned 3136 by flink:vkGetPhysicalDeviceVideoCapabilitiesKHR for the video profile 3137 pname:videoSession was created with, then 3138 pname:pPictureResource->imageViewBinding of all elements of 3139 pname:pReferenceSlots with a non-`NULL` pname:pPictureResource member 3140 must: specify image views created from the same image 3141ifdef::VK_KHR_video_decode_queue[] 3142 * [[VUID-VkVideoBeginCodingInfoKHR-slotIndex-07245]] 3143 If pname:videoSession was created with a decode operation and the 3144 pname:slotIndex member of any element of pname:pReferenceSlots is not 3145 negative, then the image view specified in 3146 pname:pPictureResource->imageViewBinding for that element must: have 3147 been created with ename:VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR 3148endif::VK_KHR_video_decode_queue[] 3149ifdef::VK_KHR_video_encode_queue[] 3150 * [[VUID-VkVideoBeginCodingInfoKHR-slotIndex-07246]] 3151 If pname:videoSession was created with an encode operation and the 3152 pname:slotIndex member of any element of pname:pReferenceSlots is not 3153 negative, then the image view specified in 3154 pname:pPictureResource->imageViewBinding for that element must: have 3155 been created with ename:VK_IMAGE_USAGE_VIDEO_ENCODE_DPB_BIT_KHR 3156endif::VK_KHR_video_encode_queue[] 3157ifdef::VK_KHR_video_decode_h264[] 3158 * [[VUID-VkVideoBeginCodingInfoKHR-videoSession-07247]] 3159 If pname:videoSession was created with the video codec operation 3160 ename:VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, then 3161 pname:videoSessionParameters must: not be dname:VK_NULL_HANDLE 3162endif::VK_KHR_video_decode_h264[] 3163ifdef::VK_KHR_video_decode_h265[] 3164 * [[VUID-VkVideoBeginCodingInfoKHR-videoSession-07248]] 3165 If pname:videoSession was created with the video codec operation 3166 ename:VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, then 3167 pname:videoSessionParameters must: not be dname:VK_NULL_HANDLE 3168endif::VK_KHR_video_decode_h265[] 3169ifdef::VK_KHR_video_encode_h264[] 3170 * [[VUID-VkVideoBeginCodingInfoKHR-videoSession-07249]] 3171 If pname:videoSession was created with the video codec operation 3172 ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR, then 3173 pname:videoSessionParameters must: not be dname:VK_NULL_HANDLE 3174endif::VK_KHR_video_encode_h264[] 3175ifdef::VK_KHR_video_encode_h265[] 3176 * [[VUID-VkVideoBeginCodingInfoKHR-videoSession-07250]] 3177 If pname:videoSession was created with the video codec operation 3178 ename:VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, then 3179 pname:videoSessionParameters must: not be dname:VK_NULL_HANDLE 3180endif::VK_KHR_video_encode_h265[] 3181 * [[VUID-VkVideoBeginCodingInfoKHR-videoSessionParameters-04857]] 3182 If pname:videoSessionParameters is not dname:VK_NULL_HANDLE, it must: 3183 have been created with pname:videoSession specified in 3184 slink:VkVideoSessionParametersCreateInfoKHR::pname:videoSession 3185**** 3186 3187include::{generated}/validity/structs/VkVideoBeginCodingInfoKHR.adoc[] 3188-- 3189 3190[open,refpage='VkVideoBeginCodingFlagsKHR',desc='Reserved for future use',type='flags'] 3191-- 3192include::{generated}/api/flags/VkVideoBeginCodingFlagsKHR.adoc[] 3193 3194tname:VkVideoBeginCodingFlagsKHR is a bitmask type for setting a mask, but 3195is currently reserved for future use. 3196-- 3197 3198[open,refpage='VkVideoReferenceSlotInfoKHR',desc='Structure specifying information about a reference picture slot',type='structs'] 3199-- 3200The sname:VkVideoReferenceSlotInfoKHR structure is defined as: 3201 3202include::{generated}/api/structs/VkVideoReferenceSlotInfoKHR.adoc[] 3203 3204 * pname:sType is a elink:VkStructureType value identifying this structure. 3205 * pname:pNext is `NULL` or a pointer to a structure extending this 3206 structure. 3207 * pname:slotIndex is the index of the <<dpb-slot, DPB slot>> or a negative 3208 integer value. 3209 * pname:pPictureResource is `NULL` or a pointer to a 3210 slink:VkVideoPictureResourceInfoKHR structure describing the 3211 <<video-picture-resources,video picture resource>> associated with the 3212 DPB slot index specified by pname:slotIndex. 3213 3214include::{generated}/validity/structs/VkVideoReferenceSlotInfoKHR.adoc[] 3215-- 3216 3217[open,refpage='vkCmdEndVideoCodingKHR',desc='End video coding scope',type='protos'] 3218-- 3219To end a video coding scope, call: 3220 3221include::{generated}/api/protos/vkCmdEndVideoCodingKHR.adoc[] 3222 3223 * pname:commandBuffer is the command buffer in which to record the 3224 command. 3225 * pname:pEndCodingInfo is a pointer to a slink:VkVideoEndCodingInfoKHR 3226 structure specifying the parameters for ending the video coding scope. 3227 3228After ending a video coding scope, the video session object, the optional 3229video session parameters object, and all 3230<<bound-reference-picture-resources, reference picture resources>> 3231previously bound by the corresponding flink:vkCmdBeginVideoCodingKHR command 3232are _unbound_. 3233 3234.Valid Usage 3235**** 3236 * [[VUID-vkCmdEndVideoCodingKHR-None-07251]] 3237 There must: be no <<queries-operation-active,active>> queries 3238**** 3239 3240include::{generated}/validity/protos/vkCmdEndVideoCodingKHR.adoc[] 3241-- 3242 3243[open,refpage='VkVideoEndCodingInfoKHR',desc='Structure specifying video coding scope end information',type='structs'] 3244-- 3245The sname:VkVideoEndCodingInfoKHR structure is defined as: 3246 3247include::{generated}/api/structs/VkVideoEndCodingInfoKHR.adoc[] 3248 3249 * pname:sType is a elink:VkStructureType value identifying this structure. 3250 * pname:pNext is `NULL` or a pointer to a structure extending this 3251 structure. 3252 * pname:flags is reserved for future use. 3253 3254include::{generated}/validity/structs/VkVideoEndCodingInfoKHR.adoc[] 3255-- 3256 3257[open,refpage='VkVideoEndCodingFlagsKHR',desc='Reserved for future use',type='flags'] 3258-- 3259include::{generated}/api/flags/VkVideoEndCodingFlagsKHR.adoc[] 3260 3261tname:VkVideoEndCodingFlagsKHR is a bitmask type for setting a mask, but is 3262currently reserved for future use. 3263-- 3264 3265 3266[[video-coding-control]] 3267== Video Coding Control 3268 3269[open,refpage='vkCmdControlVideoCodingKHR',desc='Control video coding parameters',type='protos'] 3270-- 3271To apply dynamic controls to the currently bound video session object, call: 3272 3273include::{generated}/api/protos/vkCmdControlVideoCodingKHR.adoc[] 3274 3275 * pname:commandBuffer is the command buffer in which to record the 3276 command. 3277 * pname:pCodingControlInfo is a pointer to a 3278 slink:VkVideoCodingControlInfoKHR structure specifying the control 3279 parameters. 3280 3281The control parameters provided in this call are applied to the video 3282session at the time the command executes on the device and are in effect 3283until a subsequent call to this command with the same video session bound 3284changes the corresponding control parameters. 3285 3286A newly created video session must: be reset before performing video coding 3287operations using it by including ename:VK_VIDEO_CODING_CONTROL_RESET_BIT_KHR 3288in pname:pCodingControlInfo->flags. 3289The reset operation also returns all DPB slots of the video session to the 3290<<dpb-slot-states,inactive state>>. 3291Correspondingly, any DPB slot index associated with the 3292<<bound-reference-picture-resources,bound reference picture resources>> is 3293removed. 3294 3295ifdef::VK_KHR_video_encode_queue[] 3296For encode sessions, the reset operation returns <<encode-rate-control,rate 3297control>> configuration to implementation default settings and sets the 3298<<encode-quality-level,video encode quality level>> to zero. 3299endif::VK_KHR_video_encode_queue[] 3300 3301After video coding operations are performed using a video session, the reset 3302operation can: be used to return the video session to the same _initial_ 3303state as after the reset of a newly created video session. 3304This can: be used, for example, when different video sequences are needed to 3305be processed with the same video session object. 3306 3307ifdef::VK_KHR_video_encode_queue[] 3308If pname:pCodingControlInfo->flags includes 3309ename:VK_VIDEO_CODING_CONTROL_ENCODE_RATE_CONTROL_BIT_KHR, then the command 3310replaces the <<encode-rate-control,rate control>> configuration maintained 3311by the video session with the configuration specified in the 3312slink:VkVideoEncodeRateControlInfoKHR structure included in the 3313pname:pCodingControlInfo->pNext chain. 3314 3315If pname:pCodingControlInfo->flags includes 3316ename:VK_VIDEO_CODING_CONTROL_ENCODE_QUALITY_LEVEL_BIT_KHR, then the command 3317changes the current <<encode-quality-level,video encode quality level>> to 3318the value specified in the pname:qualityLevel member of the 3319slink:VkVideoEncodeQualityLevelInfoKHR structure included in the 3320pname:pCodingControlInfo->pNext chain. 3321endif::VK_KHR_video_encode_queue[] 3322 3323.Valid Usage 3324**** 3325 * [[VUID-vkCmdControlVideoCodingKHR-flags-07017]] 3326 If pname:pCodingControlInfo->flags does not include 3327 ename:VK_VIDEO_CODING_CONTROL_RESET_BIT_KHR, then the bound video 3328 session must: not be in <<video-session-uninitialized,uninitialized>> 3329 state at the time the command is executed on the device 3330ifdef::VK_KHR_video_encode_queue[] 3331 * [[VUID-vkCmdControlVideoCodingKHR-pCodingControlInfo-08243]] 3332 If the bound video session was not created with an encode operation, 3333 then pname:pCodingControlInfo->pNext must: not include 3334 ename:VK_VIDEO_CODING_CONTROL_ENCODE_RATE_CONTROL_BIT_KHR or 3335 ename:VK_VIDEO_CODING_CONTROL_ENCODE_QUALITY_LEVEL_BIT_KHR 3336endif::VK_KHR_video_encode_queue[] 3337**** 3338 3339include::{generated}/validity/protos/vkCmdControlVideoCodingKHR.adoc[] 3340-- 3341 3342[open,refpage='VkVideoCodingControlInfoKHR',desc='Structure specifying video coding control parameters',type='structs'] 3343-- 3344The sname:VkVideoCodingControlInfoKHR structure is defined as: 3345 3346include::{generated}/api/structs/VkVideoCodingControlInfoKHR.adoc[] 3347 3348 * pname:sType is a elink:VkStructureType value identifying this structure. 3349 * pname:pNext is `NULL` or a pointer to a structure extending this 3350 structure. 3351 * pname:flags is a bitmask of tlink:VkVideoCodingControlFlagsKHR 3352 specifying control flags. 3353 3354.Valid Usage 3355**** 3356ifdef::VK_KHR_video_encode_queue[] 3357 * [[VUID-VkVideoCodingControlInfoKHR-flags-07018]] 3358 If pname:flags includes 3359 ename:VK_VIDEO_CODING_CONTROL_ENCODE_RATE_CONTROL_BIT_KHR, then the 3360 pname:pNext chain must: include a slink:VkVideoEncodeRateControlInfoKHR 3361 structure 3362 * [[VUID-VkVideoCodingControlInfoKHR-flags-08349]] 3363 If pname:flags includes 3364 ename:VK_VIDEO_CODING_CONTROL_ENCODE_QUALITY_LEVEL_BIT_KHR, then the 3365 pname:pNext chain must: include a slink:VkVideoEncodeQualityLevelInfoKHR 3366 structure 3367endif::VK_KHR_video_encode_queue[] 3368**** 3369 3370include::{generated}/validity/structs/VkVideoCodingControlInfoKHR.adoc[] 3371-- 3372 3373[open,refpage='VkVideoCodingControlFlagBitsKHR',desc='Video coding control flags',type='enums'] 3374-- 3375Bits which can: be set in slink:VkVideoCodingControlInfoKHR::pname:flags, 3376specifying the video coding control parameters to be modified, are: 3377 3378include::{generated}/api/enums/VkVideoCodingControlFlagBitsKHR.adoc[] 3379 3380 * ename:VK_VIDEO_CODING_CONTROL_RESET_BIT_KHR indicates a request for the 3381 bound video session to be reset before other coding control parameters 3382 are applied. 3383ifdef::VK_KHR_video_encode_queue[] 3384 * ename:VK_VIDEO_CODING_CONTROL_ENCODE_RATE_CONTROL_BIT_KHR indicates that 3385 the coding control parameters include video encode rate control 3386 parameters (see slink:VkVideoEncodeRateControlInfoKHR). 3387 * ename:VK_VIDEO_CODING_CONTROL_ENCODE_QUALITY_LEVEL_BIT_KHR indicates 3388 that the coding control parameters include video encode quality level 3389 parameters (see slink:VkVideoEncodeQualityLevelInfoKHR). 3390endif::VK_KHR_video_encode_queue[] 3391-- 3392 3393[open,refpage='VkVideoCodingControlFlagsKHR',desc='Bitmask of VkVideoCodingControlFlagBitsKHR',type='flags'] 3394-- 3395include::{generated}/api/flags/VkVideoCodingControlFlagsKHR.adoc[] 3396 3397tname:VkVideoCodingControlFlagsKHR is a bitmask type for setting a mask of 3398zero or more elink:VkVideoCodingControlFlagBitsKHR. 3399-- 3400 3401 3402ifdef::VK_KHR_video_maintenance1[] 3403[[video-inline-queries]] 3404== Inline Queries 3405 3406If a video session was created with 3407ename:VK_VIDEO_SESSION_CREATE_INLINE_QUERIES_BIT_KHR, beginning queries 3408using commands such as flink:vkCmdBeginQuery within a video coding scope is 3409not allowed. 3410Instead, queries are executed inline by including an instance of the 3411slink:VkVideoInlineQueryInfoKHR structure in the pname:pNext chain of the 3412parameters of one of the video coding commands, with its pname:queryPool 3413member set to a valid sname:VkQueryPool handle. 3414 3415[open,refpage='VkVideoInlineQueryInfoKHR',desc='Structure specifying inline query information for video coding commands',type='structs'] 3416-- 3417The sname:VkVideoInlineQueryInfoKHR structure is defined as: 3418 3419include::{generated}/api/structs/VkVideoInlineQueryInfoKHR.adoc[] 3420 3421 * pname:sType is a elink:VkStructureType value identifying this structure. 3422 * pname:pNext is `NULL` or a pointer to a structure extending this 3423 structure. 3424 * pname:queryPool is dname:VK_NULL_HANDLE or a valid handle to a 3425 slink:VkQueryPool object that will manage the results of the queries. 3426 * pname:firstQuery is the query index within the query pool that will 3427 contain the query results for the first video coding operation. 3428 The query results of subsequent video coding operations will be 3429 contained by subsequent query indices. 3430 * pname:queryCount is the number of queries to execute. 3431+ 3432[NOTE] 3433.Note 3434==== 3435In practice, if pname:queryPool is not dname:VK_NULL_HANDLE, then 3436pname:queryCount will always have to match the number of video coding 3437operations issued by the video coding command this structure is specified 3438to, meaning that using inline queries in a video coding command will always 3439execute a query for each issued video coding operation. 3440==== 3441 3442This structure can: be included in the pname:pNext chain of the input 3443parameter structure of video coding commands. 3444 3445ifdef::VK_KHR_video_decode_queue[] 3446 * In the pname:pNext chain of the pname:pDecodeInfo parameter of the 3447 flink:vkCmdDecodeVideoKHR command to execute a query for each video 3448 decode operation issued by the command. 3449endif::VK_KHR_video_decode_queue[] 3450ifdef::VK_KHR_video_encode_queue[] 3451 * In the pname:pNext chain of the pname:pEncodeInfo parameter of the 3452 flink:vkCmdEncodeVideoKHR command to execute a query for each video 3453 encode operation issued by the command. 3454endif::VK_KHR_video_encode_queue[] 3455 3456.Valid Usage 3457**** 3458 * [[VUID-VkVideoInlineQueryInfoKHR-queryPool-08372]] 3459 If pname:queryPool is not dname:VK_NULL_HANDLE, then pname:firstQuery 3460 must: be less than the number of queries in pname:queryPool 3461 * [[VUID-VkVideoInlineQueryInfoKHR-queryPool-08373]] 3462 If pname:queryPool is not dname:VK_NULL_HANDLE, then the sum of 3463 pname:firstQuery and pname:queryCount must: be less than or equal to the 3464 number of queries in pname:queryPool 3465**** 3466 3467include::{generated}/validity/structs/VkVideoInlineQueryInfoKHR.adoc[] 3468-- 3469endif::VK_KHR_video_maintenance1[] 3470 3471 3472ifdef::VK_KHR_video_decode_queue[] 3473include::{chapters}/video/decode.adoc[] 3474endif::VK_KHR_video_decode_queue[] 3475 3476ifdef::VK_KHR_video_decode_h264[] 3477include::{chapters}/video/h264_decode.adoc[] 3478endif::VK_KHR_video_decode_h264[] 3479 3480ifdef::VK_KHR_video_decode_h265[] 3481include::{chapters}/video/h265_decode.adoc[] 3482endif::VK_KHR_video_decode_h265[] 3483 3484ifdef::VK_KHR_video_encode_queue[] 3485include::{chapters}/video/encode.adoc[] 3486endif::VK_KHR_video_encode_queue[] 3487 3488ifdef::VK_KHR_video_encode_h264[] 3489include::{chapters}/video/h264_encode.adoc[] 3490endif::VK_KHR_video_encode_h264[] 3491 3492ifdef::VK_KHR_video_encode_h265[] 3493include::{chapters}/video/h265_encode.adoc[] 3494endif::VK_KHR_video_encode_h265[] 3495