Skip to content

Commit

Permalink
Workaround for nvidia driver bug - demote IMMUTABLE buffers to DEFAULT
Browse files Browse the repository at this point in the history
  • Loading branch information
baldurk committed Feb 21, 2017
1 parent f98be94 commit 4b60073
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions renderdoc/driver/d3d11/d3d11_device_wrap.cpp
Expand Up @@ -49,6 +49,17 @@ bool WrappedID3D11Device::Serialise_CreateBuffer(const D3D11_BUFFER_DESC *pDesc,
if(m_State >= WRITING || GetLogVersion() >= 0x000007)
m_pSerialiser->AlignNextBuffer(32);

// work around an nvidia driver bug, if a buffer is created as IMMUTABLE then it
// can't be CopySubresourceRegion'd with a box offset, the data that's read is
// wrong.
if(m_State < WRITING && Descriptor.Usage == D3D11_USAGE_IMMUTABLE)
{
Descriptor.Usage = D3D11_USAGE_DEFAULT;
// paranoid - I don't know what requirements might change, so set some sane default
if(Descriptor.BindFlags == 0)
Descriptor.BindFlags = D3D11_BIND_VERTEX_BUFFER;
}

SERIALISE_ELEMENT_BUF(byte *, InitialData, pInitialData->pSysMem, Descriptor.ByteWidth);

uint64_t offs = m_pSerialiser->GetOffset() - Descriptor.ByteWidth;
Expand Down

0 comments on commit 4b60073

Please sign in to comment.