https://chromium.googlesource.com/angle/angle/+/49317d7332b268b9415e54b1cc611b4bcd9b6a2bcommit 49317d7332b268b9415e54b1cc611b4bcd9b6a2b
Author: Shahbaz Youssefi <
syou...@chromium.org>
Date: Fri May 10 20:11:59 2024
Prepare resource map for being potentially thread-safe
Resource maps are used for both shared and context-private resources.
Context-private resource maps do not need any locking. Once glBind* and
similar commands are made free of the share group lock, the resource map
of the corresponding type must be made thread safe, especially for look
up.
This change adds the ability to the resource map to be either thread
safe or not, based on the type of the resource it contains. Currently,
only a test type (unsigned int) is thread safe (used in unit tests).
This is achieved by a combination of the following:
- For resource maps that need a lock, the flat part of the map has an
initially reasonable size, but is _never_ reallocated. This makes
access to that part of the map lockfree.
- The hash-map that contains large ids is always protected by a mutex.
Follow up changes will start enabling thread-safety for resources as
their corresponding glBind command is made lockless.
Bug: angleproject:8667
Change-Id: Ia4ffffee41f021d833d31f296bc883bf12f1135f
Reviewed-on:
https://chromium-review.googlesource.com/c/angle/angle/+/5527771Reviewed-by: Geoff Lang <
geof...@chromium.org>