Fix an image destruction deadlock.

The EGL image extension allows a texture image to be shared with another
texture. We previously prevented destroying them as long as they are shared
but the parent texture (which owns the resource lock for all its images)
could be destroyed before the EGL image is destroyed, causing a deadlock
when trying to acquire the resource lock. The situation was aggravated by
increasing the parent texture's reference count with the image reference
count (i.e. not the 'owning' texture's reference count). This fix ensures
that the parent texture can only destroy the images it owns.

Bug 18680652

Change-Id: I7fa09d181e695cbc287e77874bdb88f24c22cbd8
Reviewed-on: https://swiftshader-review.googlesource.com/1601
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
44 files changed
tree: 07c09b48a49ec1dee94dec7bcd71671997a1b26a
  1. include/
  2. src/
  3. tests/
  4. Readme.txt