OSDN Git Service

Fix assert while updating surface buffers.
authorNicolas Capens <capn@google.com>
Thu, 22 Feb 2018 21:13:01 +0000 (16:13 -0500)
committerNicolas Capens <nicolascapens@google.com>
Mon, 26 Feb 2018 15:50:36 +0000 (15:50 +0000)
commitae7756e000b6eccf7f9c4a5410c3c29e16b1eb06
treea3c038fef22a86c1722c35383dbf8dc5f596e261
parent680bcf50597a8a6939f9023a4c8ebed597f9c4ae
Fix assert while updating surface buffers.

When the external buffer of a surface is dirty, and we're trying to
lock the internal buffer (or vice-versa), an 'update' needs to happen.
This resulted in us locking the internal buffer for writing, thereby
marking it as dirty. This triggered an assert which checks that both
buffers can't be dirty at the same time. Also, in release mode this
could result in redundant updates when the external buffer is locked
again.

We should mark the destination buffer dirty when we're about to make
sure it's up to date, so a new lock type was added which is equivalent
to a write lock but without setting the dirty flag.

Also, we were allocating memory for a 0x0 stencil buffer for each
render target, when there's no stencil component. So return nullptr
when the format is NULL.

Change-Id: Ie7b5528e3eedc3c3efdf8461047e6284b7bdfc84
Reviewed-on: https://swiftshader-review.googlesource.com/16828
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
src/Renderer/Surface.cpp
src/Renderer/Surface.hpp