EGL: Fix repeated extension lookups

When adding support for GLES layers, we refactored
eglGetProcAddress to allow layers to intercept functions
unknown to the Loader. During the cleanup, we broke slot
tracking if an extension were looked up multiple times.
Follow up queries would use an incremented slot that
had not been initialized:

  eglGetProcAddress("foo1") = fptr0:0x77e2c2abd8
  eglGetProcAddress("foo2") = fptr1:0x77e2c2abf4
  eglGetProcAddress("foo3") = fptr2:0x77e2c2ac10
  eglGetProcAddress("foo1") = fptr3:0x77e2c2ac2c <= wrong
  eglGetProcAddress("foo2") = fptr4:0x77e2c2ac2c <= repeated
  eglGetProcAddress("foo3") = fptr5:0x77e2c2ac2c <= repeated

This CL tracks which slot was used for a given extension,
and when it is queried a second time, we look up the
correct slot using extensionSlotMap.

  eglGetProcAddress("foo1") = fptr0:0x77e2c2abd8
  eglGetProcAddress("foo2") = fptr1:0x77e2c2abf4
  eglGetProcAddress("foo3") = fptr2:0x77e2c2ac10
  eglGetProcAddress("foo1") = fptr3:0x77e2c2abd8 <= correct
  eglGetProcAddress("foo2") = fptr4:0x77e2c2abf4 <= correct
  eglGetProcAddress("foo3") = fptr5:0x77e2c2ac10 <= correct

It also refactors the code a bit to be more readable, and
fixes a typo throughout the file.

Bug: 143860847
Test: egl_api_test
Change-Id: If75c1abdb69a4d82253f28a5a80687f546e33ee0
Merged-In: If75c1abdb69a4d82253f28a5a80687f546e33ee0
1 file changed