1

I have a 3D application that use 4 thread with one deferred context each one. The problem is that when I use the deferred context to map (ID3D11DeviceContext::Map) the resource, the variables RowPitch and DepthPitch are equal to 0. I get the pointer to the mapped resource and with the memory inspector I see that it have reserve memory (like a calloc).

I have this problem only with ATI graphic cards.

The following code show where is the problem (part of hieroglyph3 engine):

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

In hieroglyph3 you can download and test it. The code is in PipeLineManagerDX11.cpp in line 688, you can find the class also check it here

Roamer-1888
  • 19,138
  • 5
  • 33
  • 44
feserr
  • 97
  • 1
  • 7
  • What are the used flags, remember that the first map in a deferred context need to be discard ? Also, you should try to turn on the debug device, it is likely to display what happen on errors. And last, AMD is always a little tricky on their driver behavior on non typical usage. – galop1n May 26 '16 at 05:33
  • @galop1n Sorry for the late answer. The flags were Ok and the debug device was turn on. This problem did not make the program crash, the only thing is that **RowPitch** and **DepthPitch** is always 0 in AMD drivers. – feserr Jun 21 '16 at 10:17

1 Answers1

1

The problem was that in ATI GPUs that function don't fill that variables. This don't happen in NVIDIA GPUs.

The solution is to use NVIDIA GPUs that fill the variables.

feserr
  • 97
  • 1
  • 7