d3d12: Fix texture array DPB encode path
authorSil Vilerino <sivileri@microsoft.com>
Thu, 22 Sep 2022 17:41:20 +0000 (13:41 -0400)
committerMarge Bot <emma+marge@anholt.net>
Thu, 22 Sep 2022 22:03:44 +0000 (22:03 +0000)
Mark D3D12_VIDEO_ENCODER_PICTURE_CONTROL_FLAG_USED_AS_REFERENCE_PICTURE when applicable

Reviewed-by: Giancarlo Devich <gdevich@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18763>

src/gallium/drivers/d3d12/d3d12_video_enc.cpp

index 7b5916d..af73806 100644 (file)
@@ -1429,6 +1429,9 @@ d3d12_video_encoder_encode_bitstream(struct pipe_video_codec * codec,
       rgReferenceTransitions.clear();
       rgReferenceTransitions.reserve(maxReferences);
 
+      if (reconPicOutputTextureDesc.pReconstructedPicture != nullptr)
+         picCtrlFlags |= D3D12_VIDEO_ENCODER_PICTURE_CONTROL_FLAG_USED_AS_REFERENCE_PICTURE;
+
       // Check if array of textures vs texture array
 
       if (referenceFramesDescriptor.pSubresources == nullptr) {
@@ -1445,8 +1448,6 @@ d3d12_video_encoder_encode_bitstream(struct pipe_video_codec * codec,
 
          // Transition all subresources the output recon pic independent resource allocation
          if (reconPicOutputTextureDesc.pReconstructedPicture != nullptr) {
-            picCtrlFlags |= D3D12_VIDEO_ENCODER_PICTURE_CONTROL_FLAG_USED_AS_REFERENCE_PICTURE;
-
             rgReferenceTransitions.push_back(
                CD3DX12_RESOURCE_BARRIER::Transition(reconPicOutputTextureDesc.pReconstructedPicture,
                                                     D3D12_RESOURCE_STATE_COMMON,