FrameCapture: Reset VertexArray state This change includes three things: - Tracking resources by context - Resetting VertexArray state - Splitting ResetReplay into per-context All three are needed to properly Reset Vertex Array objects. Vertex Arrays are considered container objects, which means they are not shared with other contexts. We've had a hole in Reset where we did not take multiple contexts into account. To address this, we now also track which contextID was used to modify a resource. For objects that need to know which context they are bound to, we track them in a map and return the correct index when getTrackedResource is called. To generate the calls to reset Vertex Array state, we are able to mirror what has been done for other ResourceTypeIDs. In order to properly Reset resources in multiple contexts, we have to bind the correct context before emitting the Reset calls. This has been done for Setup already, so we have a template to follow. With this CL, we now emit multiple functions to Reset state, similar to the following: void ResetReplayContextShared() { // Reset shared objects ... } void ResetReplayContext5() { // Bind the right context eglMakeCurrent(EGL_NO_DISPLAY, EGL_NO_SURFACE, EGL_NO_SURFACE, context5); // Reset container objects for context5 ... } void ResetReplayContext6() { // Bind the right context eglMakeCurrent(EGL_NO_DISPLAY, EGL_NO_SURFACE, EGL_NO_SURFACE, context6); // Reset container objects for context6 ... } void ResetReplay() { EGLContext context = eglGetCurrentContext(); ResetReplayContextShared(); ResetReplayContext5(); ResetReplayContext6(); eglMakeCurrent(EGL_NO_DISPLAY, EGL_NO_SURFACE, EGL_NO_SURFACE, context); } Test: Ni no Kuni MEC Bug: angleproject:4599 Bug: angleproject:7507 Change-Id: Ic585534f07172474aab0ce1d0396b0b064379f88 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3761874 Commit-Queue: Cody Northrop <cnorthrop@google.com> Reviewed-by: Lubosz Sarnecki <lubosz.sarnecki@collabora.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com>