From: Sil Vilerino Date: Thu, 15 Dec 2022 17:24:17 +0000 (-0500) Subject: d3d12: Add ASSERTED to variables only used in debug builds to fix build MSVC with... X-Git-Tag: upstream/23.3.3~15484 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=002096fcc45fb35f5d6370b22f97343853f72c8a;p=platform%2Fupstream%2Fmesa.git d3d12: Add ASSERTED to variables only used in debug builds to fix build MSVC with C4189 errors Part-of: --- diff --git a/src/gallium/drivers/d3d12/d3d12_residency.cpp b/src/gallium/drivers/d3d12/d3d12_residency.cpp index 1879a30..dd413f3 100644 --- a/src/gallium/drivers/d3d12/d3d12_residency.cpp +++ b/src/gallium/drivers/d3d12/d3d12_residency.cpp @@ -278,7 +278,7 @@ d3d12_promote_to_permanent_residency(struct d3d12_screen *screen, struct d3d12_r bool was_made_resident = (base_bo->residency_status == d3d12_resident); if(!was_made_resident) { ID3D12Pageable *pageable = base_bo->res; - HRESULT hr = screen->dev->MakeResident(1, &pageable); + ASSERTED HRESULT hr = screen->dev->MakeResident(1, &pageable); assert(SUCCEEDED(hr)); } } diff --git a/src/gallium/drivers/d3d12/d3d12_video_dec.cpp b/src/gallium/drivers/d3d12/d3d12_video_dec.cpp index 9c04d9a..4789306 100644 --- a/src/gallium/drivers/d3d12/d3d12_video_dec.cpp +++ b/src/gallium/drivers/d3d12/d3d12_video_dec.cpp @@ -195,7 +195,7 @@ d3d12_video_decoder_decode_bitstream(struct pipe_video_codec *codec, assert(pD3D12Dec->m_spD3D12VideoDevice); assert(pD3D12Dec->m_spDecodeCommandQueue); assert(pD3D12Dec->m_pD3D12Screen); - struct d3d12_video_buffer *pD3D12VideoBuffer = (struct d3d12_video_buffer *) target; + ASSERTED struct d3d12_video_buffer *pD3D12VideoBuffer = (struct d3d12_video_buffer *) target; assert(pD3D12VideoBuffer); /// @@ -444,7 +444,7 @@ d3d12_video_decoder_end_frame(struct pipe_video_codec *codec, d3d12InputArguments.CompressedBitstream.pBuffer = pD3D12Dec->m_curFrameCompressedBitstreamBuffer.Get(); d3d12InputArguments.CompressedBitstream.Offset = 0u; - constexpr uint64_t d3d12BitstreamOffsetAlignment = + ASSERTED constexpr uint64_t d3d12BitstreamOffsetAlignment = 128u; // specified in // https://docs.microsoft.com/en-us/windows/win32/api/d3d12video/ne-d3d12video-d3d12_video_decode_tier assert((d3d12InputArguments.CompressedBitstream.Offset == 0) || diff --git a/src/gallium/drivers/d3d12/d3d12_video_dec_references_mgr.cpp b/src/gallium/drivers/d3d12/d3d12_video_dec_references_mgr.cpp index 38c331e..2393739 100644 --- a/src/gallium/drivers/d3d12/d3d12_video_dec_references_mgr.cpp +++ b/src/gallium/drivers/d3d12/d3d12_video_dec_references_mgr.cpp @@ -213,7 +213,7 @@ d3d12_video_decoder_references_manager::d3d12_video_decoder_references_manager( m_dpbDescriptor(m_dpbDescriptor), m_formatInfo({ m_dpbDescriptor.Format }) { - HRESULT hr = m_pD3D12Screen->dev->CheckFeatureSupport(D3D12_FEATURE_FORMAT_INFO, &m_formatInfo, sizeof(m_formatInfo)); + ASSERTED HRESULT hr = m_pD3D12Screen->dev->CheckFeatureSupport(D3D12_FEATURE_FORMAT_INFO, &m_formatInfo, sizeof(m_formatInfo)); assert(SUCCEEDED(hr)); D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC targetFrameResolution = { static_cast(m_dpbDescriptor.Width), m_dpbDescriptor.Height }; @@ -328,7 +328,7 @@ d3d12_video_decoder_references_manager::store_future_reference(uint16_t // Set the index as the key in this map entry. m_referenceDXVAIndices[remappedIndex].originalIndex = index; IUnknown *pUnkHeap = nullptr; - HRESULT hr = decoderHeap.Get()->QueryInterface(IID_PPV_ARGS(&pUnkHeap)); + ASSERTED HRESULT hr = decoderHeap.Get()->QueryInterface(IID_PPV_ARGS(&pUnkHeap)); assert(SUCCEEDED(hr)); d3d12_video_reconstructed_picture reconPic = { pTexture2D, subresourceIndex, pUnkHeap }; @@ -362,7 +362,7 @@ d3d12_video_decoder_references_manager::release_unused_references_texture_memory if (!m_referenceDXVAIndices[index].fUsed) { d3d12_video_reconstructed_picture reconPicture = m_upD3D12TexturesStorageManager->get_reference_frame(index); if (reconPicture.pReconstructedPicture != nullptr) { - bool wasTracked = m_upD3D12TexturesStorageManager->untrack_reconstructed_picture_allocation(reconPicture); + ASSERTED bool wasTracked = m_upD3D12TexturesStorageManager->untrack_reconstructed_picture_allocation(reconPicture); // Untrack this resource, will mark it as free un the underlying storage buffer pool // if not tracked, must be due to no-copies allocation assert (wasTracked || is_pipe_buffer_underlying_output_decode_allocation()); diff --git a/src/gallium/drivers/d3d12/d3d12_video_encoder_bitstream.cpp b/src/gallium/drivers/d3d12/d3d12_video_encoder_bitstream.cpp index 8bba6de..b5a255a 100644 --- a/src/gallium/drivers/d3d12/d3d12_video_encoder_bitstream.cpp +++ b/src/gallium/drivers/d3d12/d3d12_video_encoder_bitstream.cpp @@ -235,7 +235,7 @@ d3d12_video_encoder_bitstream::put_bits(int32_t uiBitsCount, uint32_t iBitsVal) void d3d12_video_encoder_bitstream::flush() { - bool isAligned = is_byte_aligned(); // causes side-effects in object state, don't put inside assert() + ASSERTED bool isAligned = is_byte_aligned(); // causes side-effects in object state, don't put inside assert() assert(isAligned); uint32_t temp = (uint32_t)(32 - m_iBitsToGo); @@ -257,10 +257,10 @@ d3d12_video_encoder_bitstream::flush() void d3d12_video_encoder_bitstream::append_byte_stream(d3d12_video_encoder_bitstream *pStream) { - bool isStreamAligned = + ASSERTED bool isStreamAligned = pStream->is_byte_aligned(); // causes side-effects in object state, don't put inside assert() assert(isStreamAligned); - bool isThisAligned = is_byte_aligned(); // causes side-effects in object state, don't put inside assert() + ASSERTED bool isThisAligned = is_byte_aligned(); // causes side-effects in object state, don't put inside assert() assert(isThisAligned); assert(m_iBitsToGo == 32); diff --git a/src/gallium/drivers/d3d12/d3d12_video_encoder_nalu_writer_h264.cpp b/src/gallium/drivers/d3d12/d3d12_video_encoder_nalu_writer_h264.cpp index afd7804..95dab62 100644 --- a/src/gallium/drivers/d3d12/d3d12_video_encoder_nalu_writer_h264.cpp +++ b/src/gallium/drivers/d3d12/d3d12_video_encoder_nalu_writer_h264.cpp @@ -34,7 +34,7 @@ d3d12_video_nalu_writer_h264::rbsp_trailing(d3d12_video_encoder_bitstream *pBits pBitstream->put_bits(iLeft, 0); } - bool isAligned = pBitstream->is_byte_aligned(); // causes side-effects in object state, don't put inside assert() + ASSERTED bool isAligned = pBitstream->is_byte_aligned(); // causes side-effects in object state, don't put inside assert() assert(isAligned); } diff --git a/src/gallium/drivers/d3d12/d3d12_video_encoder_nalu_writer_hevc.cpp b/src/gallium/drivers/d3d12/d3d12_video_encoder_nalu_writer_hevc.cpp index 1e8038c..98a8a34 100644 --- a/src/gallium/drivers/d3d12/d3d12_video_encoder_nalu_writer_hevc.cpp +++ b/src/gallium/drivers/d3d12/d3d12_video_encoder_nalu_writer_hevc.cpp @@ -386,7 +386,7 @@ d3d12_video_nalu_writer_hevc::wrap_rbsp_into_nalu(d3d12_video_encoder_bitstream d3d12_video_encoder_bitstream *pRBSP, HEVCNaluHeader *pHeader) { - bool isAligned = pRBSP->is_byte_aligned(); // causes side-effects in object state, don't put inside assert() + ASSERTED bool isAligned = pRBSP->is_byte_aligned(); // causes side-effects in object state, don't put inside assert() assert(isAligned); int32_t iBytesWritten = pNALU->get_byte_count(); @@ -454,7 +454,7 @@ d3d12_video_nalu_writer_hevc::rbsp_trailing(d3d12_video_encoder_bitstream *pBits pBitstream->put_bits(iLeft, 0); } - bool isAligned = pBitstream->is_byte_aligned(); // causes side-effects in object state, don't put inside assert() + ASSERTED bool isAligned = pBitstream->is_byte_aligned(); // causes side-effects in object state, don't put inside assert() assert(isAligned); } @@ -517,4 +517,4 @@ d3d12_video_nalu_writer_hevc::write_rps(d3d12_video_encoder_bitstream* rbsp, Hev rbsp->put_bits(1, rps->used_by_curr_pic_s1_flag[i]); } } -} \ No newline at end of file +} diff --git a/src/gallium/drivers/d3d12/d3d12_video_encoder_references_manager_h264.cpp b/src/gallium/drivers/d3d12/d3d12_video_encoder_references_manager_h264.cpp index 7c26298..5bef2e4 100644 --- a/src/gallium/drivers/d3d12/d3d12_video_encoder_references_manager_h264.cpp +++ b/src/gallium/drivers/d3d12/d3d12_video_encoder_references_manager_h264.cpp @@ -52,8 +52,8 @@ d3d12_video_encoder_references_manager_h264::reset_gop_tracking_and_dpb() m_CurrentFrameReferencesData.ReconstructedPicTexture = { nullptr, 0 }; // Reset DPB storage - uint32_t numPicsBeforeClearInDPB = m_rDPBStorageManager.get_number_of_pics_in_dpb(); - uint32_t cFreedResources = m_rDPBStorageManager.clear_decode_picture_buffer(); + ASSERTED uint32_t numPicsBeforeClearInDPB = m_rDPBStorageManager.get_number_of_pics_in_dpb(); + ASSERTED uint32_t cFreedResources = m_rDPBStorageManager.clear_decode_picture_buffer(); assert(numPicsBeforeClearInDPB == cFreedResources); // Initialize if needed the reconstructed picture allocation for the first IDR picture in the GOP diff --git a/src/gallium/drivers/d3d12/d3d12_video_encoder_references_manager_hevc.cpp b/src/gallium/drivers/d3d12/d3d12_video_encoder_references_manager_hevc.cpp index 174b58b..4860ac5 100644 --- a/src/gallium/drivers/d3d12/d3d12_video_encoder_references_manager_hevc.cpp +++ b/src/gallium/drivers/d3d12/d3d12_video_encoder_references_manager_hevc.cpp @@ -53,8 +53,8 @@ d3d12_video_encoder_references_manager_hevc::reset_gop_tracking_and_dpb() m_CurrentFrameReferencesData.ReconstructedPicTexture = { nullptr, 0 }; // Reset DPB storage - uint32_t numPicsBeforeClearInDPB = m_rDPBStorageManager.get_number_of_pics_in_dpb(); - uint32_t cFreedResources = m_rDPBStorageManager.clear_decode_picture_buffer(); + ASSERTED uint32_t numPicsBeforeClearInDPB = m_rDPBStorageManager.get_number_of_pics_in_dpb(); + ASSERTED uint32_t cFreedResources = m_rDPBStorageManager.clear_decode_picture_buffer(); assert(numPicsBeforeClearInDPB == cFreedResources); // Initialize if needed the reconstructed picture allocation for the first IDR picture in the GOP