layers: Protect GetImage/BufferMemRqmts map access
authorJean-François Marquis <jfmarquis@gmail.com>
Mon, 30 Oct 2017 22:14:15 +0000 (18:14 -0400)
committerMark Lobodzinski <mark@lunarg.com>
Fri, 3 Nov 2017 15:19:22 +0000 (09:19 -0600)
commit9ef531dfcde2c23bd3d8008c36439ad4f6aa79ce
treee1f93206874262e3aca56b6119437ba284aaa502
parent9a8815136e5d086adac39f6e015c6e4728e5dc88
layers: Protect GetImage/BufferMemRqmts map access

Lock 'global_lock' while looking for IMAGE_STATE/BUFFER_STATE in
GetBufferMemoryRequirements/GetImageMemoryRequirements. This is needed
because other threads could add/remove other VkImage handles to/from
the maps concurrently. The specs say the VkImage must be externally
synchronized, but this doesn't cover the internals of the layers about
VkImages in general. vkCreateImage, vkDestroyImage and
vkBindImageMemory/vkBindBufferMemory correctly lock 'global_lock'.

Change-Id: I93cb00c9a7f99efc927da52e42103ab72516397e
layers/core_validation.cpp