Function Prototype

vkCmdEncodeVideoKHR

Launch video encode operations
primary
outside
inside
encode
action

To launch video encode operations, call:

void vkCmdEncodeVideoKHR(
    VkCommandBuffer commandBuffer,
    const VkVideoEncodeInfoKHR* pEncodeInfo);
  • commandBuffer is the command buffer in which to record the command.
  • pEncodeInfo is a pointer to a VkVideoEncodeInfoKHR structure specifying the parameters of the video encode operations.

Each call issues one or more video encode operations. The implicit parameter opCount corresponds to the number of video encode operations issued by the command. After calling this command, the active query index of each active query is incremented by opCount.

Currently each call to this command results in the issue of a single video encode operation.

If the bound video session was created with VK_VIDEO_SESSION_CREATE_INLINE_QUERIES_BIT_KHR and the pNext chain of pEncodeInfo includes a VkVideoInlineQueryInfoKHR structure with its queryPool member specifying a valid VkQueryPool handle, then this command will execute a query for each video encode operation issued by it.

Active Reference Picture Information

The list of active reference pictures used by a video encode operation is a list of image subregions used as the source of reference picture data and related parameters, and is derived from the VkVideoReferenceSlotInfoKHR structures provided as the elements of the pEncodeInfo→pReferenceSlots array. For each element of pEncodeInfo→pReferenceSlots, one or more elements are added to the active reference picture list, as defined by the codec-specific semantics. Each element of this list contains the following information:

  • The image subregion within the image subresource referred to by the video picture resource used as the reference picture.
  • The DPB slot index the reference picture is associated with.
  • The codec-specific reference information related to the reference picture.
Reconstructed Picture Information

Information related to the optional reconstructed picture used by a video encode operation is derived from the VkVideoReferenceSlotInfoKHR structure pointed to by pEncodeInfo→pSetupReferenceSlot, if not NULL, as defined by the codec-specific semantics, and consists of the following:

  • The image subregion within the image subresource referred to by the video picture resource used as the reconstructed picture.
  • The DPB slot index to use for picture reconstruction.
  • The codec-specific reference information related to the reconstructed picture.

Specifying a valid VkVideoReferenceSlotInfoKHR structure in pEncodeInfo→pSetupReferenceSlot is always required, unless the video session was created with VkVideoSessionCreateInfoKHR::maxDpbSlot equal to zero. However, the DPB slot identified by pEncodeInfo→pSetupReferenceSlot→slotIndex is only activated with the reconstructed picture specified in pEncodeInfo→pSetupReferenceSlot→pPictureResource if reference picture setup is requested according to the codec-specific semantics.

If reconstructed picture information is specified, but reference picture setup is not requested, according to the codec-specific semantics, the contents of the video picture resource corresponding to the reconstructed picture will be undefined: after the video encode operation.

Some implementations may always output the reconstructed picture or use it as temporary storage during the video encode operation even when the reconstructed picture is not marked for future reference.

Encode Input Picture Information

Information related to the encode input picture used by a video encode operation is derived from pEncodeInfo→srcPictureResource and any codec-specific parameters provided in the pEncodeInfo→pNext chain, as defined by the codec-specific semantics, and consists of the following:

  • The image subregion within the image subresource referred to by the video picture resource used as the encode input picture.
  • The codec-specific picture information related to the encoded picture.

Several limiting values are defined below that are referenced by the relevant valid usage statements of this command.

  • Let uint32_t activeReferencePictureCount be the size of the list of active reference pictures used by the video encode operation. Unless otherwise defined, activeReferencePictureCount is set to the value of pEncodeInfo→referenceSlotCount.
  • Let VkOffset2D codedOffsetGranularity be the minimum alignment requirement for the coded offset of video picture resources. Unless otherwise defined, the value of the x and y members of codedOffsetGranularity are 0.
  • Let uint32_t dpbFrameUseCount[] be an array of size maxDpbSlots, where maxDpbSlots is the VkVideoSessionCreateInfoKHR::maxDpbSlots the bound video session was created with, with each element indicating the number of times a frame associated with the corresponding DPB slot index is referred to by the video coding operation. Let the initial value of each element of the array be 0.
    • If pEncodeInfo→pSetupReferenceSlot is not NULL, then dpbFrameUseCount[i] is incremented by one, where i equals pEncodeInfo→pSetupReferenceSlot→slotIndex.
    • For each element of pEncodeInfo→pReferenceSlots, dpbFrameUseCount[i] is incremented by one, where i equals the slotIndex member of the corresponding element.
  • Let VkExtent2D maxCodingBlockSize be the maximum codec-specific coding block size that may be used by the video encode operation.
  • If maxCodingBlockSize is defined, then let VkExtent2D minCodingBlockExtent be the coded extent of the encode input picture expressed in terms of codec-specific coding blocks, assuming the maximum size of such coding blocks, as defined by maxCodingBlockSize, calculated from the value of the codedExtent member of pEncodeInfo→srcPictureResource as follows:
    • minCodingBlockExtent.width = (codedExtent.width\
      maxCodingBlockSize.width - 1) / maxCodingBlockSize.width
    • minCodingBlockExtent.height = (codedExtent.height\
      maxCodingBlockSize.height - 1) / maxCodingBlockSize.height
  • If the bound video session object was created with an H.264 encode profile, then:
    • Let StdVideoH264PictureType h264PictureType be the picture type of the encoded picture set to the value of pStdPictureInfo→primary_pic_type specified in the VkVideoEncodeH264PictureInfoKHR structure included in the pEncodeInfo→pNext chain.
    • Let StdVideoH264PictureType h264L0PictureTypes[] and StdVideoH264PictureType h264L1PictureTypes[] be the picture types of the reference pictures in the L0 and L1 reference lists, respectively. If pStdPictureInfo→pRefLists specified in the VkVideoEncodeH264PictureInfoKHR structure included in the pEncodeInfo→pNext chain is not NULL, then for each reference index specified in the elements of the pStdPictureInfo→pRefLists→RefPicList0 and pStdPictureInfo→pRefLists→RefPicList1 arrays, if the reference index is not STD_VIDEO_H264_NO_REFERENCE_PICTURE, pStdReferenceInfo→primary_pic_type is added to h264L0PictureTypes or h264L1PictureTypes, respectively, where pStdReferenceInfo is the member of the VkVideoEncodeH264DpbSlotInfoKHR structure included in the pNext chain of the element of pEncodeInfo→pReferenceSlots for which slotIndex equals the reference index in question.
  • If the bound video session object was created with an H.265 encode profile, then:
    • Let StdVideoH265PictureType h265PictureType be the picture type of the encoded picture set to the value of pStdPictureInfo→pic_type specified in the VkVideoEncodeH265PictureInfoKHR structure included in the pEncodeInfo→pNext chain.
    • Let StdVideoH265PictureType h265L0PictureTypes[] and StdVideoH265PictureType h265L1PictureTypes[] be the picture types of the reference pictures in the L0 and L1 reference lists, respectively. If pStdPictureInfo→pRefLists specified in the VkVideoEncodeH265PictureInfoKHR structure included in the pEncodeInfo→pNext chain is not NULL, then for each reference index specified in the elements of the pStdPictureInfo→pRefLists→RefPicList0 and pStdPictureInfo→pRefLists→RefPicList1 arrays, if the reference index is not STD_VIDEO_H265_NO_REFERENCE_PICTURE, pStdReferenceInfo→pic_type is added to h265L0PictureTypes or h265L1PictureTypes, respectively, where pStdReferenceInfo is the member of the VkVideoEncodeH265DpbSlotInfoKHR structure included in the pNext chain of the element of pEncodeInfo→pReferenceSlots for which slotIndex equals the reference index in question.

Valid Usage

VUID-vkCmdEncodeVideoKHR-None-08250

The bound video session must have been created with an encode operation

VUID-vkCmdEncodeVideoKHR-None-07012

The bound video session must not be in uninitialized state at the time the command is executed on the device

VUID-vkCmdEncodeVideoKHR-None-08318

The bound video session parameters object must have been created with the currently set video encode quality level for the bound video session at the time the command is executed on the device

VUID-vkCmdEncodeVideoKHR-opCount-07174

For each active query, the active query index corresponding to the query type of that query plus opCount must be less than or equal to the last activatable query index corresponding to the query type of that query plus one

VUID-vkCmdEncodeVideoKHR-pNext-08360

If the bound video session was created with VK_VIDEO_SESSION_CREATE_INLINE_QUERIES_BIT_KHR, and the pNext chain of pEncodeInfo includes a VkVideoInlineQueryInfoKHR structure with its queryPool member specifying a valid VkQueryPool handle, then VkVideoInlineQueryInfoKHR::queryCount must equal opCount

VUID-vkCmdEncodeVideoKHR-pNext-08361

If the bound video session was created with VK_VIDEO_SESSION_CREATE_INLINE_QUERIES_BIT_KHR, and the pNext chain of pEncodeInfo includes a VkVideoInlineQueryInfoKHR structure with its queryPool member specifying a valid VkQueryPool handle, then all the queries used by the command, as specified by the VkVideoInlineQueryInfoKHR structure, must be unavailable

VUID-vkCmdEncodeVideoKHR-queryType-08362

If the bound video session was created with VK_VIDEO_SESSION_CREATE_INLINE_QUERIES_BIT_KHR, then the queryType used to create the queryPool specified in the VkVideoInlineQueryInfoKHR structure included in the pNext chain of pEncodeInfo must be VK_QUERY_TYPE_RESULT_STATUS_ONLY_KHR or VK_QUERY_TYPE_VIDEO_ENCODE_FEEDBACK_KHR

VUID-vkCmdEncodeVideoKHR-queryPool-08363

If the bound video session was created with VK_VIDEO_SESSION_CREATE_INLINE_QUERIES_BIT_KHR, then the queryPool specified in the VkVideoInlineQueryInfoKHR structure included in the pNext chain of pEncodeInfo must have been created with a VkVideoProfileInfoKHR structure included in the pNext chain of VkQueryPoolCreateInfo identical to the one specified in VkVideoSessionCreateInfoKHR::pVideoProfile the bound video session was created with

VUID-vkCmdEncodeVideoKHR-queryType-08364

If the bound video session was created with VK_VIDEO_SESSION_CREATE_INLINE_QUERIES_BIT_KHR, and the queryType used to create the queryPool specified in the VkVideoInlineQueryInfoKHR structure included in the pNext chain of pEncodeInfo is VK_QUERY_TYPE_RESULT_STATUS_ONLY_KHR, then the VkCommandPool that commandBuffer was allocated from must have been created with a queue family index that supports result status queries, as indicated by VkQueueFamilyQueryResultStatusPropertiesKHR::queryResultStatusSupport

VUID-vkCmdEncodeVideoKHR-pEncodeInfo-08201

pEncodeInfo→dstBuffer must be compatible with the video profile the bound video session was created with

VUID-vkCmdEncodeVideoKHR-commandBuffer-08202

If commandBuffer is an unprotected command buffer and protectedNoFault is not supported, then pEncodeInfo→dstBuffer must not be a protected buffer

VUID-vkCmdEncodeVideoKHR-commandBuffer-08203

If commandBuffer is a protected command buffer and protectedNoFault is not supported, then pEncodeInfo→dstBuffer must be a protected buffer

VUID-vkCmdEncodeVideoKHR-pEncodeInfo-08204

pEncodeInfo→dstBufferOffset must be an integer multiple of VkVideoCapabilitiesKHR::minBitstreamBufferOffsetAlignment, as returned by vkGetPhysicalDeviceVideoCapabilitiesKHR for the video profile the bound video session was created with

VUID-vkCmdEncodeVideoKHR-pEncodeInfo-08205

pEncodeInfo→dstBufferRange must be an integer multiple of VkVideoCapabilitiesKHR::minBitstreamBufferSizeAlignment, as returned by vkGetPhysicalDeviceVideoCapabilitiesKHR for the video profile the bound video session was created with

VUID-vkCmdEncodeVideoKHR-pEncodeInfo-08206

pEncodeInfo→srcPictureResource.imageViewBinding must be compatible with the video profile the bound video session was created with

VUID-vkCmdEncodeVideoKHR-pEncodeInfo-08207

The format of pEncodeInfo→srcPictureResource.imageViewBindingmust match the VkVideoSessionCreateInfoKHR::pictureFormat the bound video session was created with

VUID-vkCmdEncodeVideoKHR-pEncodeInfo-08208

pEncodeInfo→srcPictureResource.codedOffset must be an integer multiple of codedOffsetGranularity

VUID-vkCmdEncodeVideoKHR-pEncodeInfo-08209

pEncodeInfo→srcPictureResource.codedExtent must be between minCodedExtent and maxCodedExtent, inclusive, the bound video session was created with

VUID-vkCmdEncodeVideoKHR-pEncodeInfo-08210

pEncodeInfo→srcPictureResource.imageViewBinding must have been created with VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR

VUID-vkCmdEncodeVideoKHR-commandBuffer-08211

If commandBuffer is an unprotected command buffer and protectedNoFault is not supported, then pEncodeInfo→srcPictureResource.imageViewBinding must not have been created from a protected image

VUID-vkCmdEncodeVideoKHR-commandBuffer-08212

If commandBuffer is a protected command buffer and protectedNoFault is not supported, then pEncodeInfo→srcPictureResource.imageViewBinding must have been created from a protected image

VUID-vkCmdEncodeVideoKHR-pEncodeInfo-08377

pEncodeInfo→pSetupReferenceSlot must not be NULL unless the bound video session was created with VkVideoSessionCreateInfoKHR::maxDpbSlots equal to zero

VUID-vkCmdEncodeVideoKHR-pEncodeInfo-08213

If pEncodeInfo→pSetupReferenceSlot is not NULL, then pEncodeInfo→pSetupReferenceSlot→slotIndex must be less than the VkVideoSessionCreateInfoKHR::maxDpbSlots specified when the bound video session was created

VUID-vkCmdEncodeVideoKHR-pEncodeInfo-08214

If pEncodeInfo→pSetupReferenceSlot is not NULL, then pEncodeInfo→pSetupReferenceSlot→pPictureResource→codedOffsetmust be an integer multiple of codedOffsetGranularity

VUID-vkCmdEncodeVideoKHR-pEncodeInfo-08215

If pEncodeInfo→pSetupReferenceSlot is not NULL, then pEncodeInfo→pSetupReferenceSlot→pPictureResource mustmatch one of the bound reference picture resource

VUID-vkCmdEncodeVideoKHR-activeReferencePictureCount-08216

activeReferencePictureCount must be less than or equal to the VkVideoSessionCreateInfoKHR::maxActiveReferencePictures specified when the bound video session was created

VUID-vkCmdEncodeVideoKHR-slotIndex-08217

The slotIndex member of each element of pEncodeInfo→pReferenceSlots must be less than the VkVideoSessionCreateInfoKHR::maxDpbSlots specified when the bound video session was created

VUID-vkCmdEncodeVideoKHR-codedOffset-08218

The codedOffset member of the VkVideoPictureResourceInfoKHR structure pointed to by the pPictureResource member of each element of pEncodeInfo→pReferenceSlots must be an integer multiple of codedOffsetGranularity

VUID-vkCmdEncodeVideoKHR-pPictureResource-08219

The pPictureResource member of each element of pEncodeInfo→pReferenceSlots mustmatch one of the bound reference picture resource associated with the DPB slot index specified in the slotIndex member of that element

VUID-vkCmdEncodeVideoKHR-pPictureResource-08220

Each video picture resource corresponding to the pPictureResource member specified in the elements of pEncodeInfo→pReferenceSlotsmust be unique within pEncodeInfo→pReferenceSlots

VUID-vkCmdEncodeVideoKHR-dpbFrameUseCount-08221

All elements of dpbFrameUseCount must be less than or equal to 1

VUID-vkCmdEncodeVideoKHR-pEncodeInfo-08222

The image subresource referred to by pEncodeInfo→srcPictureResource must be in the VK_IMAGE_LAYOUT_VIDEO_ENCODE_SRC_KHR layout at the time the video encode operation is executed on the device

VUID-vkCmdEncodeVideoKHR-pEncodeInfo-08223

If pEncodeInfo→pSetupReferenceSlot is not NULL, then the image subresource referred to by pEncodeInfo→pSetupReferenceSlot→pPictureResource must be in the VK_IMAGE_LAYOUT_VIDEO_ENCODE_DPB_KHR layout at the time the video encode operation is executed on the device

VUID-vkCmdEncodeVideoKHR-pPictureResource-08224

The image subresource referred to by the pPictureResource member of each element of pEncodeInfo→pReferenceSlots must be in the VK_IMAGE_LAYOUT_VIDEO_ENCODE_DPB_KHR layout at the time the video encode operation is executed on the device

VUID-vkCmdEncodeVideoKHR-pNext-08225

If the bound video session was created with the video codec operation VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR, then the pNext chain of pEncodeInfo must include a VkVideoEncodeH264PictureInfoKHR structure

VUID-vkCmdEncodeVideoKHR-StdVideoH264SequenceParameterSet-08226

If the bound video session was created with the video codec operation VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR, then the bound video session parameters object must contain a StdVideoH264SequenceParameterSet entry with seq_parameter_set_id matching StdVideoEncodeH264PictureInfo::seq_parameter_set_id that is provided in the pStdPictureInfo member of the VkVideoEncodeH264PictureInfoKHR structure included in the pNext chain of pEncodeInfo

VUID-vkCmdEncodeVideoKHR-StdVideoH264PictureParameterSet-08227

If the bound video session was created with the video codec operation VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR, then the bound video session parameters object must contain a StdVideoH264PictureParameterSet entry with seq_parameter_set_id and pic_parameter_set_id matching StdVideoEncodeH264PictureInfo::seq_parameter_set_id and StdVideoEncodeH264PictureInfo::pic_parameter_set_id, respectively, that are provided in the pStdPictureInfo member of the VkVideoEncodeH264PictureInfoKHR structure included in the pNext chain of pEncodeInfo

VUID-vkCmdEncodeVideoKHR-pEncodeInfo-08228

If the bound video session was created with the video codec operation VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR and pEncodeInfo→pSetupReferenceSlot is not NULL, then the pNext chain of pEncodeInfo→pSetupReferenceSlot must include a VkVideoEncodeH264DpbSlotInfoKHR structure

VUID-vkCmdEncodeVideoKHR-pNext-08229

If the bound video session was created with the video codec operation VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR, then the pNext chain of each element of pEncodeInfo→pReferenceSlots must include a VkVideoEncodeH264DpbSlotInfoKHR structure

VUID-vkCmdEncodeVideoKHR-constantQp-08269

If the bound video session was created with the video codec operation VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR and the current rate control mode is not VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DISABLED_BIT_KHR, then VkVideoEncodeH264NaluSliceInfoKHR::constantQp must be zero for each element of the pNaluSliceEntries member of the VkVideoEncodeH264PictureInfoKHR structure included in the pNext chain of pEncodeInfo

VUID-vkCmdEncodeVideoKHR-constantQp-08270

If the bound video session was created with the video codec operation VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR and the current rate control mode is VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DISABLED_BIT_KHR, then VkVideoEncodeH264NaluSliceInfoKHR::constantQp must be between VkVideoEncodeH264CapabilitiesKHR::minQp and VkVideoEncodeH264CapabilitiesKHR::maxQp, as returned by vkGetPhysicalDeviceVideoCapabilitiesKHR for the video profile the bound video session was created with, for each element of the pNaluSliceEntries member of the VkVideoEncodeH264PictureInfoKHR structure included in the pNext chain of pEncodeInfo

VUID-vkCmdEncodeVideoKHR-constantQp-08271

If the bound video session was created with the video codec operation VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR and VkVideoEncodeH264CapabilitiesKHR::flags does not include VK_VIDEO_ENCODE_H264_CAPABILITY_PER_SLICE_CONSTANT_QP_BIT_KHR, as returned by vkGetPhysicalDeviceVideoCapabilitiesKHR for the video profile the bound video session was created with, then VkVideoEncodeH264NaluSliceInfoKHR::constantQp must have the same value for each element of the pNaluSliceEntries member of the VkVideoEncodeH264PictureInfoKHR structure included in the pNext chain of pEncodeInfo

VUID-vkCmdEncodeVideoKHR-naluSliceEntryCount-08302

If the bound video session was created with the video codec operation VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR, then the naluSliceEntryCount member of the VkVideoEncodeH264PictureInfoKHR structure included in the pNext chain of pEncodeInfo must be less than or equal to minCodingBlockExtent.width multiplied by minCodingBlockExtent.height

VUID-vkCmdEncodeVideoKHR-naluSliceEntryCount-08312

If the bound video session was created with the video codec operation VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR and VkVideoEncodeH264CapabilitiesKHR::flags does not include VK_VIDEO_ENCODE_H264_CAPABILITY_ROW_UNALIGNED_SLICE_BIT_KHR, as returned by vkGetPhysicalDeviceVideoCapabilitiesKHR for the video profile the bound video session was created with, then the naluSliceEntryCount member of the VkVideoEncodeH264PictureInfoKHR structure included in the pNext chain of pEncodeInfo must be less than or equal to minCodingBlockExtent.height

VUID-vkCmdEncodeVideoKHR-pNext-08352

If the bound video session was created with the video codec operation VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR, the pNext chain of pEncodeInfo includes a VkVideoEncodeH264PictureInfoKHR structure, and pEncodeInfo→referenceSlotCount is greater than zero, then VkVideoEncodeH264PictureInfoKHR::pStdPictureInfo→pRefListsmust not be NULL

VUID-vkCmdEncodeVideoKHR-pNext-08339

If the bound video session was created with the video codec operation VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR, the pNext chain of pEncodeInfo includes a VkVideoEncodeH264PictureInfoKHR structure, and VkVideoEncodeH264PictureInfoKHR::pStdPictureInfo→pRefLists is not NULL, then each element of the RefPicList0 and RefPicList1 array members of the StdVideoEncodeH264ReferenceListsInfo structure pointed to by VkVideoEncodeH264PictureInfoKHR::pStdPictureInfo→pRefListsmust either be STD_VIDEO_H264_NO_REFERENCE_PICTURE or must equal the slotIndex member of one of the elements of pEncodeInfo→pReferenceSlots

VUID-vkCmdEncodeVideoKHR-pNext-08353

If the bound video session was created with the video codec operation VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR, the pNext chain of pEncodeInfo includes a VkVideoEncodeH264PictureInfoKHR structure, and pEncodeInfo→referenceSlotCount is greater than zero, then the slotIndex member of each element of pEncodeInfo→pReferenceSlots must equal one of the elements of the RefPicList0 or RefPicList1 array members of the StdVideoEncodeH264ReferenceListsInfo structure pointed to by VkVideoEncodeH264PictureInfoKHR::pStdPictureInfo→pRefLists

VUID-vkCmdEncodeVideoKHR-maxPPictureL0ReferenceCount-08340

If the bound video session was created with the video codec operation VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR and VkVideoEncodeH264CapabilitiesKHR::maxPPictureL0ReferenceCount is zero, as returned by vkGetPhysicalDeviceVideoCapabilitiesKHR for the video profile the bound video session was created with, then h264PictureType and each element of h264L0PictureTypes and h264L1PictureTypes must not be STD_VIDEO_H264_PICTURE_TYPE_P

VUID-vkCmdEncodeVideoKHR-maxBPictureL0ReferenceCount-08341

If the bound video session was created with the video codec operation VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR and VkVideoEncodeH264CapabilitiesKHR::maxBPictureL0ReferenceCount and VkVideoEncodeH264CapabilitiesKHR::maxL1ReferenceCount are both zero, as returned by vkGetPhysicalDeviceVideoCapabilitiesKHR for the video profile the bound video session was created with, then h264PictureType and each element of h264L0PictureTypes and h264L1PictureTypesmust not be STD_VIDEO_H264_PICTURE_TYPE_B

VUID-vkCmdEncodeVideoKHR-flags-08342

If the bound video session was created with the video codec operation VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR and VkVideoEncodeH264CapabilitiesKHR::flags does not include VK_VIDEO_ENCODE_H264_CAPABILITY_B_FRAME_IN_L0_LIST_BIT_KHR, as returned by vkGetPhysicalDeviceVideoCapabilitiesKHR for the video profile the bound video session was created with, then each element of h264L0PictureTypes must not be STD_VIDEO_H264_PICTURE_TYPE_B

VUID-vkCmdEncodeVideoKHR-flags-08343

If the bound video session was created with the video codec operation VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR and VkVideoEncodeH264CapabilitiesKHR::flags does not include VK_VIDEO_ENCODE_H264_CAPABILITY_B_FRAME_IN_L1_LIST_BIT_KHR, as returned by vkGetPhysicalDeviceVideoCapabilitiesKHR for the video profile the bound video session was created with, then each element of h264L1PictureTypes must not be STD_VIDEO_H264_PICTURE_TYPE_B

VUID-vkCmdEncodeVideoKHR-pNext-08230

If the bound video session was created with the video codec operation VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, then the pNext chain of pEncodeInfo must include a VkVideoEncodeH265PictureInfoKHR structure

VUID-vkCmdEncodeVideoKHR-StdVideoH265VideoParameterSet-08231

If the bound video session was created with the video codec operation VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, then the bound video session parameters object must contain a StdVideoH265VideoParameterSet entry with vps_video_parameter_set_id matching StdVideoEncodeH265PictureInfo::sps_video_parameter_set_id that is provided in the pStdPictureInfo member of the VkVideoEncodeH265PictureInfoKHR structure included in the pNext chain of pEncodeInfo

VUID-vkCmdEncodeVideoKHR-StdVideoH265SequenceParameterSet-08232

If the bound video session was created with the video codec operation VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, then the bound video session parameters object must contain a StdVideoH265SequenceParameterSet entry with sps_video_parameter_set_id and sps_seq_parameter_set_id matching StdVideoEncodeH265PictureInfo::sps_video_parameter_set_id and StdVideoEncodeH265PictureInfo::pps_seq_parameter_set_id, respectively, that are provided in the pStdPictureInfo member of the VkVideoEncodeH265PictureInfoKHR structure included in the pNext chain of pEncodeInfo

VUID-vkCmdEncodeVideoKHR-StdVideoH265PictureParameterSet-08233

If the bound video session was created with the video codec operation VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, then the bound video session parameters object must contain a StdVideoH265PictureParameterSet entry with sps_video_parameter_set_id, pps_seq_parameter_set_id, and pps_pic_parameter_set_id matching StdVideoEncodeH265PictureInfo::sps_video_parameter_set_id, StdVideoEncodeH265PictureInfo::pps_seq_parameter_set_id, and StdVideoEncodeH265PictureInfo::pps_pic_parameter_set_id, respectively, that are provided in the pStdPictureInfo member of the VkVideoEncodeH265PictureInfoKHR structure included in the pNext chain of pEncodeInfo

VUID-vkCmdEncodeVideoKHR-pEncodeInfo-08234

If the bound video session was created with the video codec operation VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR and pEncodeInfo→pSetupReferenceSlot is not NULL, then the pNext chain of pEncodeInfo→pSetupReferenceSlot must include a VkVideoEncodeH265DpbSlotInfoKHR structure

VUID-vkCmdEncodeVideoKHR-pNext-08235

If the bound video session was created with the video codec operation VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, then the pNext chain of each element of pEncodeInfo→pReferenceSlots must include a VkVideoEncodeH265DpbSlotInfoKHR structure

VUID-vkCmdEncodeVideoKHR-constantQp-08272

If the bound video session was created with the video codec operation VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR and the current rate control mode is not VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DISABLED_BIT_KHR, then VkVideoEncodeH265NaluSliceSegmentInfoKHR::constantQp must be zero for each element of the pNaluSliceSegmentEntries member of the VkVideoEncodeH265PictureInfoKHR structure included in the pNext chain of pEncodeInfo

VUID-vkCmdEncodeVideoKHR-constantQp-08273

If the bound video session was created with the video codec operation VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR and the current rate control mode is VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DISABLED_BIT_KHR, then VkVideoEncodeH265NaluSliceSegmentInfoKHR::constantQp must be between VkVideoEncodeH265CapabilitiesKHR::minQp and VkVideoEncodeH265CapabilitiesKHR::maxQp, as returned by vkGetPhysicalDeviceVideoCapabilitiesKHR for the video profile the bound video session was created with, for each element of the pNaluSliceSegmentEntries member of the VkVideoEncodeH265PictureInfoKHR structure included in the pNext chain of pEncodeInfo

VUID-vkCmdEncodeVideoKHR-constantQp-08274

If the bound video session was created with the video codec operation VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR and VkVideoEncodeH265CapabilitiesKHR::flags does not include VK_VIDEO_ENCODE_H265_CAPABILITY_PER_SLICE_SEGMENT_CONSTANT_QP_BIT_KHR, as returned by vkGetPhysicalDeviceVideoCapabilitiesKHR for the video profile the bound video session was created with, then VkVideoEncodeH265NaluSliceSegmentInfoKHR::constantQp must have the same value for each element of the pNaluSliceSegmentEntries member of the VkVideoEncodeH264PictureInfoKHR structure included in the pNext chain of pEncodeInfo

VUID-vkCmdEncodeVideoKHR-naluSliceSegmentEntryCount-08307

If the bound video session was created with the video codec operation VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, then the naluSliceSegmentEntryCount member of the VkVideoEncodeH265PictureInfoKHR structure included in the pNext chain of pEncodeInfo must be less than or equal to minCodingBlockExtent.width multiplied by minCodingBlockExtent.height

VUID-vkCmdEncodeVideoKHR-naluSliceSegmentEntryCount-08313

If the bound video session was created with the video codec operation VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR and VkVideoEncodeH265CapabilitiesKHR::flags does not include VK_VIDEO_ENCODE_H265_CAPABILITY_ROW_UNALIGNED_SLICE_SEGMENT_BIT_KHR, as returned by vkGetPhysicalDeviceVideoCapabilitiesKHR for the video profile the bound video session was created with, then the naluSliceSegmentEntryCount member of the VkVideoEncodeH265PictureInfoKHR structure included in the pNext chain of pEncodeInfo must be less than or equal to minCodingBlockExtent.height

VUID-vkCmdEncodeVideoKHR-pNext-08354

If the bound video session was created with the video codec operation VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, the pNext chain of pEncodeInfo includes a VkVideoEncodeH265PictureInfoKHR structure, and pEncodeInfo→referenceSlotCount is greater than zero, then VkVideoEncodeH265PictureInfoKHR::pStdPictureInfo→pRefListsmust not be NULL

VUID-vkCmdEncodeVideoKHR-pNext-08344

If the bound video session was created with the video codec operation VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, the pNext chain of pEncodeInfo includes a VkVideoEncodeH265PictureInfoKHR structure, and VkVideoEncodeH265PictureInfoKHR::pStdPictureInfo→pRefLists is not NULL, then each element of the RefPicList0 and RefPicList1 array members of the StdVideoEncodeH265ReferenceListsInfo structure pointed to by VkVideoEncodeH265PictureInfoKHR::pStdPictureInfo→pRefListsmust either be STD_VIDEO_H265_NO_REFERENCE_PICTURE or must equal the slotIndex member of one of the elements of pEncodeInfo→pReferenceSlots

VUID-vkCmdEncodeVideoKHR-pNext-08355

If the bound video session was created with the video codec operation VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR, the pNext chain of pEncodeInfo includes a VkVideoEncodeH265PictureInfoKHR structure, and pEncodeInfo→referenceSlotCount is greater than zero, then the slotIndex member of each element of pEncodeInfo→pReferenceSlots must equal one of the elements of the RefPicList0 or RefPicList1 array members of the StdVideoEncodeH265ReferenceListsInfo structure pointed to by VkVideoEncodeH265PictureInfoKHR::pStdPictureInfo→pRefLists

VUID-vkCmdEncodeVideoKHR-maxPPictureL0ReferenceCount-08345

If the bound video session was created with the video codec operation VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR and VkVideoEncodeH265CapabilitiesKHR::maxPPictureL0ReferenceCount is zero, as returned by vkGetPhysicalDeviceVideoCapabilitiesKHR for the video profile the bound video session was created with, then h265PictureType and each element of h265L0PictureTypes and h265L1PictureTypes must not be STD_VIDEO_H265_PICTURE_TYPE_P

VUID-vkCmdEncodeVideoKHR-maxBPictureL0ReferenceCount-08346

If the bound video session was created with the video codec operation VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR and VkVideoEncodeH265CapabilitiesKHR::maxBPictureL0ReferenceCount and VkVideoEncodeH265CapabilitiesKHR::maxL1ReferenceCount are both zero, as returned by vkGetPhysicalDeviceVideoCapabilitiesKHR for the video profile the bound video session was created with, then h265PictureType and each element of h265L0PictureTypes and h265L1PictureTypesmust not be STD_VIDEO_H265_PICTURE_TYPE_B

VUID-vkCmdEncodeVideoKHR-flags-08347

If the bound video session was created with the video codec operation VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR and VkVideoEncodeH265CapabilitiesKHR::flags does not include VK_VIDEO_ENCODE_H265_CAPABILITY_B_FRAME_IN_L0_LIST_BIT_KHR, as returned by vkGetPhysicalDeviceVideoCapabilitiesKHR for the video profile the bound video session was created with, then each element of h265L0PictureTypes must not be STD_VIDEO_H264_PICTURE_TYPE_B

VUID-vkCmdEncodeVideoKHR-flags-08348

If the bound video session was created with the video codec operation VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR and VkVideoEncodeH265CapabilitiesKHR::flags does not include VK_VIDEO_ENCODE_H265_CAPABILITY_B_FRAME_IN_L1_LIST_BIT_KHR, as returned by vkGetPhysicalDeviceVideoCapabilitiesKHR for the video profile the bound video session was created with, then each element of h265L1PictureTypes must not be STD_VIDEO_H265_PICTURE_TYPE_B

Valid Usage (Implicit)

VUID-vkCmdEncodeVideoKHR-pEncodeInfo-parameter

pEncodeInfo must be a valid pointer to a valid VkVideoEncodeInfoKHR structure

VUID-vkCmdEncodeVideoKHR-commandBuffer-cmdpool

The VkCommandPool that commandBuffer was allocated from must support encode operations

VUID-vkCmdEncodeVideoKHR-renderpass

This command must only be called outside of a render pass instance

VUID-vkCmdEncodeVideoKHR-videocoding

This command must only be called inside of a video coding scope

VUID-vkCmdEncodeVideoKHR-bufferlevel

commandBuffer must be a primary VkCommandBuffer

Host Synchronization

  • Host access to commandBuffer must be externally synchronized
  • Host access to the VkCommandPool that commandBuffer was allocated from must be externally synchronized ::