Commit e708fc02 by Jamie Madill

Only use map-write instead of map-write-discard.

In D3D11, map-discard is reserved for DYNAMIC usage buffer, which are resources that live on the GPU. Staging buffers don't have the notion of map-discard, and using them with discard gives a D3D11 error. This patch fixes crashes in dEQP buffer.map.write.invalidate. BUG=angle:587 Change-Id: Ie225e72d4e226c69e73826c9fb67bbb940bbc466 Reviewed-on: https://chromium-review.googlesource.com/190072Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarShannon Woods <shannonwoods@chromium.org> Tested-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 0c66720a
...@@ -22,18 +22,19 @@ D3D11_MAP GetD3DMapTypeFromBits(GLbitfield access) ...@@ -22,18 +22,19 @@ D3D11_MAP GetD3DMapTypeFromBits(GLbitfield access)
{ {
bool readBit = ((access & GL_MAP_READ_BIT) != 0); bool readBit = ((access & GL_MAP_READ_BIT) != 0);
bool writeBit = ((access & GL_MAP_WRITE_BIT) != 0); bool writeBit = ((access & GL_MAP_WRITE_BIT) != 0);
bool discardBit = ((access & (GL_MAP_INVALIDATE_BUFFER_BIT)) != 0);
ASSERT(!readBit || !discardBit);
ASSERT(readBit || writeBit); ASSERT(readBit || writeBit);
// Note : we ignore the discard bit, because in D3D11, staging buffers
// don't accept the map-discard flag (discard only works for DYNAMIC usage)
if (readBit && !writeBit) if (readBit && !writeBit)
{ {
return D3D11_MAP_READ; return D3D11_MAP_READ;
} }
else if (writeBit && !readBit) else if (writeBit && !readBit)
{ {
return (discardBit ? D3D11_MAP_WRITE_DISCARD : D3D11_MAP_WRITE); return D3D11_MAP_WRITE;
} }
else if (writeBit && readBit) else if (writeBit && readBit)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment