1

我有一个 3D 应用程序,它使用 4 个线程,每个线程都有一个延迟上下文。问题是当我使用延迟上下文来映射(ID3D11DeviceContext::Map)资源时,变量RowPitchDepthPitch等于 0。我得到了指向映射资源的指针,并且使用内存检查器我看到它有保留内存(如calloc)。

我只有 ATI 显卡才有这个问题。

以下代码显示问题出在哪里(hieroglyph3 引擎的一部分):

D3D11_MAPPED_SUBRESOURCE Data;
Data.pData = NULL;
Data.DepthPitch = Data.RowPitch = 0;

if ( nullptr == pGlyphResource ) {
    Log::Get().Write( L"Trying to map a subresource that doesn't exist!!!" );
    return( Data );
}
// TODO: Update this to use a ComPtr!
// Acquire the native resource pointer.
ID3D11Resource* pResource = 0;
pResource = pGlyphResource->GetResource();

if ( nullptr == pResource ) {
    Log::Get().Write( L"Trying to map a subresource that has no native resource in it!!!" );
    return( Data );
}

// Perform the mapping of the resource.
// This function must fill Data but it only fill the pointer to the mapped resource
HRESULT hr = m_pContext->Map( pResource, subresource, actions, flags, &Data );

if ( FAILED( hr ) ) {
    Log::Get().Write( L"Failed to map resource!" );
}

return( Data );

hieroglyph3中,您可以下载并测试它。代码在第 688 行的PipeLineManagerDX11.cpp中,您可以找到该类,也可以在此处查看

4

1 回答 1

1

问题在于,在 ATI GPU 中,该函数不能填充这些变量。这不会发生在 NVIDIA GPU 中。

解决方案是使用填充变量的 NVIDIA GPU。

于 2019-03-14T15:41:21.817 回答