d3d12: Add ASSERTED to variables only used in debug builds to fix build MSVC with C4189 errors

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20340>
This commit is contained in:
Sil Vilerino 2022-12-15 12:24:17 -05:00 committed by Marge Bot
parent 5df50292d6
commit 002096fcc4
8 changed files with 17 additions and 17 deletions

View file

@ -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));
}
}

View file

@ -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) ||

View file

@ -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<uint32_t>(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());

View file

@ -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);

View file

@ -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);
}

View file

@ -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]);
}
}
}
}

View file

@ -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

View file

@ -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