Use packed enum for DrawElementsType.

The packing and unpacking take a few extra instructions. But it
completely obviates the need for any switches in the validation code.
Speed is slightly faster or the similar depending on the back-end.

Also add gl_angle_ext.xml to GL entry point generator inputs. This was
missing and would cause the code generation to miss certain changes.

Bug: angleproject:2985
Change-Id: I1ea41a71db71135000166ead8305ec42d22ff7b3
Reviewed-on: https://chromium-review.googlesource.com/c/1351729
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
diff --git a/src/libANGLE/renderer/vulkan/BufferVk.cpp b/src/libANGLE/renderer/vulkan/BufferVk.cpp
index eb6f293..4fa8a3a 100644
--- a/src/libANGLE/renderer/vulkan/BufferVk.cpp
+++ b/src/libANGLE/renderer/vulkan/BufferVk.cpp
@@ -153,7 +153,7 @@
 }
 
 angle::Result BufferVk::getIndexRange(const gl::Context *context,
-                                      GLenum type,
+                                      gl::DrawElementsType type,
                                       size_t offset,
                                       size_t count,
                                       bool primitiveRestartEnabled,
@@ -177,11 +177,11 @@
     // TODO(jmadill): Consider keeping a shadow system memory copy in some cases.
     ASSERT(mBuffer.valid());
 
-    const gl::Type &typeInfo = gl::GetTypeInfo(type);
+    const GLuint &typeBytes = gl::GetDrawElementsTypeSize(type);
 
     uint8_t *mapPointer = nullptr;
     ANGLE_VK_TRY(contextVk, mBuffer.getDeviceMemory().map(contextVk->getDevice(), offset,
-                                                          typeInfo.bytes * count, 0, &mapPointer));
+                                                          typeBytes * count, 0, &mapPointer));
 
     *outRange = gl::ComputeIndexRange(type, mapPointer, count, primitiveRestartEnabled);
 
diff --git a/src/libANGLE/renderer/vulkan/BufferVk.h b/src/libANGLE/renderer/vulkan/BufferVk.h
index c45bd1e..9911758 100644
--- a/src/libANGLE/renderer/vulkan/BufferVk.h
+++ b/src/libANGLE/renderer/vulkan/BufferVk.h
@@ -49,7 +49,7 @@
     angle::Result unmap(const gl::Context *context, GLboolean *result) override;
 
     angle::Result getIndexRange(const gl::Context *context,
-                                GLenum type,
+                                gl::DrawElementsType type,
                                 size_t offset,
                                 size_t count,
                                 bool primitiveRestartEnabled,
diff --git a/src/libANGLE/renderer/vulkan/ContextVk.cpp b/src/libANGLE/renderer/vulkan/ContextVk.cpp
index 20783fe..26ac068 100644
--- a/src/libANGLE/renderer/vulkan/ContextVk.cpp
+++ b/src/libANGLE/renderer/vulkan/ContextVk.cpp
@@ -114,7 +114,7 @@
       mDrawFramebuffer(nullptr),
       mProgram(nullptr),
       mLastIndexBufferOffset(0),
-      mCurrentDrawElementsType(GL_NONE),
+      mCurrentDrawElementsType(gl::DrawElementsType::InvalidEnum),
       mClearColorMask(kAllColorChannelsMask),
       mFlipYForCurrentSurface(false),
       mDriverUniformsBuffer(VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, sizeof(DriverUniforms) * 16, true),
@@ -264,7 +264,7 @@
                                    gl::PrimitiveMode mode,
                                    GLint firstVertex,
                                    GLsizei vertexOrIndexCount,
-                                   GLenum indexTypeOrNone,
+                                   gl::DrawElementsType indexTypeOrNone,
                                    const void *indices,
                                    DirtyBits dirtyBitMask,
                                    vk::CommandBuffer **commandBufferOut)
@@ -313,7 +313,7 @@
 angle::Result ContextVk::setupIndexedDraw(const gl::Context *context,
                                           gl::PrimitiveMode mode,
                                           GLsizei indexCount,
-                                          GLenum indexType,
+                                          gl::DrawElementsType indexType,
                                           const void *indices,
                                           vk::CommandBuffer **commandBufferOut)
 {
@@ -338,7 +338,7 @@
             mVertexArray->updateCurrentElementArrayBufferOffset(mLastIndexBufferOffset);
         }
 
-        if (indexType == GL_UNSIGNED_BYTE && mDirtyBits[DIRTY_BIT_INDEX_BUFFER])
+        if (indexType == gl::DrawElementsType::UnsignedByte && mDirtyBits[DIRTY_BIT_INDEX_BUFFER])
         {
             ANGLE_TRY(mVertexArray->updateIndexTranslation(this, indexCount, indexType, indices));
         }
@@ -352,15 +352,17 @@
                                            gl::PrimitiveMode mode,
                                            GLint firstVertex,
                                            GLsizei vertexOrIndexCount,
-                                           GLenum indexTypeOrNone,
+                                           gl::DrawElementsType indexTypeOrInvalid,
                                            const void *indices,
                                            vk::CommandBuffer **commandBufferOut)
 {
-    ANGLE_TRY(mVertexArray->handleLineLoop(this, firstVertex, vertexOrIndexCount, indexTypeOrNone,
-                                           indices));
+    ANGLE_TRY(mVertexArray->handleLineLoop(this, firstVertex, vertexOrIndexCount,
+                                           indexTypeOrInvalid, indices));
     mDirtyBits.set(DIRTY_BIT_INDEX_BUFFER);
-    mCurrentDrawElementsType = indexTypeOrNone != GL_NONE ? indexTypeOrNone : GL_UNSIGNED_INT;
-    return setupDraw(context, mode, firstVertex, vertexOrIndexCount, indexTypeOrNone, indices,
+    mCurrentDrawElementsType = indexTypeOrInvalid != gl::DrawElementsType::InvalidEnum
+                                   ? indexTypeOrInvalid
+                                   : gl::DrawElementsType::UnsignedInt;
+    return setupDraw(context, mode, firstVertex, vertexOrIndexCount, indexTypeOrInvalid, indices,
                      mIndexedDirtyBitsMask, commandBufferOut);
 }
 
@@ -444,7 +446,7 @@
 {
     commandBuffer->bindIndexBuffer(mVertexArray->getCurrentElementArrayBufferHandle(),
                                    mVertexArray->getCurrentElementArrayBufferOffset(),
-                                   gl_vk::GetIndexType(mCurrentDrawElementsType));
+                                   gl_vk::kIndexTypeMap[mCurrentDrawElementsType]);
 
     vk::BufferHelper *elementArrayBuffer = mVertexArray->getCurrentElementArrayBuffer();
     if (elementArrayBuffer)
@@ -491,13 +493,14 @@
 
     if (mode == gl::PrimitiveMode::LineLoop)
     {
-        ANGLE_TRY(setupLineLoopDraw(context, mode, first, count, GL_NONE, nullptr, &commandBuffer));
+        ANGLE_TRY(setupLineLoopDraw(context, mode, first, count, gl::DrawElementsType::InvalidEnum,
+                                    nullptr, &commandBuffer));
         vk::LineLoopHelper::Draw(clampedVertexCount, commandBuffer);
     }
     else
     {
-        ANGLE_TRY(setupDraw(context, mode, first, count, GL_NONE, nullptr, mNonIndexedDirtyBitsMask,
-                            &commandBuffer));
+        ANGLE_TRY(setupDraw(context, mode, first, count, gl::DrawElementsType::InvalidEnum, nullptr,
+                            mNonIndexedDirtyBitsMask, &commandBuffer));
         commandBuffer->draw(clampedVertexCount, 1, first, 0);
     }
 
@@ -517,7 +520,7 @@
 angle::Result ContextVk::drawElements(const gl::Context *context,
                                       gl::PrimitiveMode mode,
                                       GLsizei count,
-                                      GLenum type,
+                                      gl::DrawElementsType type,
                                       const void *indices)
 {
     vk::CommandBuffer *commandBuffer = nullptr;
@@ -538,7 +541,7 @@
 angle::Result ContextVk::drawElementsInstanced(const gl::Context *context,
                                                gl::PrimitiveMode mode,
                                                GLsizei count,
-                                               GLenum type,
+                                               gl::DrawElementsType type,
                                                const void *indices,
                                                GLsizei instances)
 {
@@ -551,7 +554,7 @@
                                            GLuint start,
                                            GLuint end,
                                            GLsizei count,
-                                           GLenum type,
+                                           gl::DrawElementsType type,
                                            const void *indices)
 {
     ANGLE_VK_UNREACHABLE(this);
@@ -573,7 +576,7 @@
 
 angle::Result ContextVk::drawElementsIndirect(const gl::Context *context,
                                               gl::PrimitiveMode mode,
-                                              GLenum type,
+                                              gl::DrawElementsType type,
                                               const void *indirect)
 {
     ANGLE_VK_UNREACHABLE(this);
@@ -1159,9 +1162,9 @@
         static_cast<float>(mDrawFramebuffer->getState().getDimensions().height) * 0.5f;
 
     // Allocate a new region in the dynamic buffer.
-    uint8_t *ptr            = nullptr;
-    VkBuffer buffer         = VK_NULL_HANDLE;
-    VkDeviceSize offset     = 0;
+    uint8_t *ptr        = nullptr;
+    VkBuffer buffer     = VK_NULL_HANDLE;
+    VkDeviceSize offset = 0;
     ANGLE_TRY(mDriverUniformsBuffer.allocate(this, sizeof(DriverUniforms), &ptr, &buffer, &offset,
                                              nullptr));
     float scaleY = isViewportFlipEnabledForDrawFBO() ? -1.0f : 1.0f;
diff --git a/src/libANGLE/renderer/vulkan/ContextVk.h b/src/libANGLE/renderer/vulkan/ContextVk.h
index ad26954..9dcd31c 100644
--- a/src/libANGLE/renderer/vulkan/ContextVk.h
+++ b/src/libANGLE/renderer/vulkan/ContextVk.h
@@ -53,12 +53,12 @@
     angle::Result drawElements(const gl::Context *context,
                                gl::PrimitiveMode mode,
                                GLsizei count,
-                               GLenum type,
+                               gl::DrawElementsType type,
                                const void *indices) override;
     angle::Result drawElementsInstanced(const gl::Context *context,
                                         gl::PrimitiveMode mode,
                                         GLsizei count,
-                                        GLenum type,
+                                        gl::DrawElementsType type,
                                         const void *indices,
                                         GLsizei instances) override;
     angle::Result drawRangeElements(const gl::Context *context,
@@ -66,14 +66,14 @@
                                     GLuint start,
                                     GLuint end,
                                     GLsizei count,
-                                    GLenum type,
+                                    gl::DrawElementsType type,
                                     const void *indices) override;
     angle::Result drawArraysIndirect(const gl::Context *context,
                                      gl::PrimitiveMode mode,
                                      const void *indirect) override;
     angle::Result drawElementsIndirect(const gl::Context *context,
                                        gl::PrimitiveMode mode,
-                                       GLenum type,
+                                       gl::DrawElementsType type,
                                        const void *indirect) override;
 
     // Device loss
@@ -215,21 +215,21 @@
                             gl::PrimitiveMode mode,
                             GLint firstVertex,
                             GLsizei vertexOrIndexCount,
-                            GLenum indexTypeOrNone,
+                            gl::DrawElementsType indexTypeOrInvalid,
                             const void *indices,
                             DirtyBits dirtyBitMask,
                             vk::CommandBuffer **commandBufferOut);
     angle::Result setupIndexedDraw(const gl::Context *context,
                                    gl::PrimitiveMode mode,
                                    GLsizei indexCount,
-                                   GLenum indexType,
+                                   gl::DrawElementsType indexType,
                                    const void *indices,
                                    vk::CommandBuffer **commandBufferOut);
     angle::Result setupLineLoopDraw(const gl::Context *context,
                                     gl::PrimitiveMode mode,
                                     GLint firstVertex,
                                     GLsizei vertexOrIndexCount,
-                                    GLenum indexTypeOrNone,
+                                    gl::DrawElementsType indexTypeOrInvalid,
                                     const void *indices,
                                     vk::CommandBuffer **commandBufferOut);
 
@@ -293,7 +293,7 @@
 
     // The offset we had the last time we bound the index buffer.
     const GLvoid *mLastIndexBufferOffset;
-    GLenum mCurrentDrawElementsType;
+    gl::DrawElementsType mCurrentDrawElementsType;
 
     // Cached clear value/mask for color and depth/stencil.
     VkClearValue mClearColorValue;
diff --git a/src/libANGLE/renderer/vulkan/VertexArrayVk.cpp b/src/libANGLE/renderer/vulkan/VertexArrayVk.cpp
index 144761e..3bacd45 100644
--- a/src/libANGLE/renderer/vulkan/VertexArrayVk.cpp
+++ b/src/libANGLE/renderer/vulkan/VertexArrayVk.cpp
@@ -134,12 +134,12 @@
 }
 
 angle::Result VertexArrayVk::streamIndexData(ContextVk *contextVk,
-                                             GLenum indexType,
+                                             gl::DrawElementsType indexType,
                                              size_t indexCount,
                                              const void *sourcePointer,
                                              vk::DynamicBuffer *dynamicBuffer)
 {
-    ASSERT(!mState.getElementArrayBuffer() || indexType == GL_UNSIGNED_BYTE);
+    ASSERT(!mState.getElementArrayBuffer() || indexType == gl::DrawElementsType::UnsignedByte);
 
     dynamicBuffer->releaseRetainedBuffers(contextVk->getRenderer());
 
@@ -148,7 +148,7 @@
 
     ANGLE_TRY(dynamicBuffer->allocate(contextVk, amount, &dst, &mCurrentElementArrayBufferHandle,
                                       &mCurrentElementArrayBufferOffset, nullptr));
-    if (indexType == GL_UNSIGNED_BYTE)
+    if (indexType == gl::DrawElementsType::UnsignedByte)
     {
         // Unsigned bytes don't have direct support in Vulkan so we have to expand the
         // memory to a GLushort.
@@ -446,7 +446,7 @@
 angle::Result VertexArrayVk::updateClientAttribs(const gl::Context *context,
                                                  GLint firstVertex,
                                                  GLsizei vertexOrIndexCount,
-                                                 GLenum indexTypeOrNone,
+                                                 gl::DrawElementsType indexTypeOrInvalid,
                                                  const void *indices)
 {
     ContextVk *contextVk                    = vk::GetImpl(context);
@@ -456,8 +456,8 @@
 
     GLint startVertex;
     size_t vertexCount;
-    ANGLE_TRY(GetVertexRangeInfo(context, firstVertex, vertexOrIndexCount, indexTypeOrNone, indices,
-                                 0, &startVertex, &vertexCount));
+    ANGLE_TRY(GetVertexRangeInfo(context, firstVertex, vertexOrIndexCount, indexTypeOrInvalid,
+                                 indices, 0, &startVertex, &vertexCount));
 
     mDynamicVertexData.releaseRetainedBuffers(contextVk->getRenderer());
 
@@ -498,10 +498,10 @@
 angle::Result VertexArrayVk::handleLineLoop(ContextVk *contextVk,
                                             GLint firstVertex,
                                             GLsizei vertexOrIndexCount,
-                                            GLenum indexTypeOrNone,
+                                            gl::DrawElementsType indexTypeOrInvalid,
                                             const void *indices)
 {
-    if (indexTypeOrNone != GL_NONE)
+    if (indexTypeOrInvalid != gl::DrawElementsType::InvalidEnum)
     {
         // Handle GL_LINE_LOOP drawElements.
         if (mDirtyLineLoopTranslation)
@@ -511,7 +511,7 @@
             if (!elementArrayBuffer)
             {
                 ANGLE_TRY(mLineLoopHelper.streamIndices(
-                    contextVk, indexTypeOrNone, vertexOrIndexCount,
+                    contextVk, indexTypeOrInvalid, vertexOrIndexCount,
                     reinterpret_cast<const uint8_t *>(indices), &mCurrentElementArrayBufferHandle,
                     &mCurrentElementArrayBufferOffset));
             }
@@ -521,7 +521,7 @@
                 intptr_t offset                = reinterpret_cast<intptr_t>(indices);
                 BufferVk *elementArrayBufferVk = vk::GetImpl(elementArrayBuffer);
                 ANGLE_TRY(mLineLoopHelper.getIndexBufferForElementArrayBuffer(
-                    contextVk, elementArrayBufferVk, indexTypeOrNone, vertexOrIndexCount, offset,
+                    contextVk, elementArrayBufferVk, indexTypeOrInvalid, vertexOrIndexCount, offset,
                     &mCurrentElementArrayBufferHandle, &mCurrentElementArrayBufferOffset));
             }
         }
@@ -555,10 +555,10 @@
 
 angle::Result VertexArrayVk::updateIndexTranslation(ContextVk *contextVk,
                                                     GLsizei indexCount,
-                                                    GLenum type,
+                                                    gl::DrawElementsType type,
                                                     const void *indices)
 {
-    ASSERT(type != GL_NONE);
+    ASSERT(type != gl::DrawElementsType::InvalidEnum);
 
     gl::Buffer *glBuffer = mState.getElementArrayBuffer();
 
@@ -571,7 +571,7 @@
         // Needed before reading buffer or we could get stale data.
         ANGLE_TRY(contextVk->getRenderer()->finish(contextVk));
 
-        ASSERT(type == GL_UNSIGNED_BYTE);
+        ASSERT(type == gl::DrawElementsType::UnsignedByte);
         // Unsigned bytes don't have direct support in Vulkan so we have to expand the
         // memory to a GLushort.
         BufferVk *bufferVk   = vk::GetImpl(glBuffer);
diff --git a/src/libANGLE/renderer/vulkan/VertexArrayVk.h b/src/libANGLE/renderer/vulkan/VertexArrayVk.h
index 8cc606e..9688d51 100644
--- a/src/libANGLE/renderer/vulkan/VertexArrayVk.h
+++ b/src/libANGLE/renderer/vulkan/VertexArrayVk.h
@@ -46,13 +46,13 @@
     angle::Result updateClientAttribs(const gl::Context *context,
                                       GLint firstVertex,
                                       GLsizei vertexOrIndexCount,
-                                      GLenum indexTypeOrNone,
+                                      gl::DrawElementsType indexTypeOrInvalid,
                                       const void *indices);
 
     angle::Result handleLineLoop(ContextVk *contextVk,
                                  GLint firstVertex,
                                  GLsizei vertexOrIndexCount,
-                                 GLenum indexTypeOrNone,
+                                 gl::DrawElementsType indexTypeOrInvalid,
                                  const void *indices);
 
     const gl::AttribArray<VkBuffer> &getCurrentArrayBufferHandles() const
@@ -86,7 +86,7 @@
 
     angle::Result updateIndexTranslation(ContextVk *contextVk,
                                          GLsizei indexCount,
-                                         GLenum type,
+                                         gl::DrawElementsType type,
                                          const void *indices);
 
   private:
@@ -101,7 +101,7 @@
                                const gl::VertexAttribute &attrib);
 
     angle::Result streamIndexData(ContextVk *contextVk,
-                                  GLenum indexType,
+                                  gl::DrawElementsType indexType,
                                   size_t indexCount,
                                   const void *sourcePointer,
                                   vk::DynamicBuffer *dynamicBuffer);
diff --git a/src/libANGLE/renderer/vulkan/shaders/gen/FullScreenQuad.vert.00000000.inc b/src/libANGLE/renderer/vulkan/shaders/gen/FullScreenQuad.vert.00000000.inc
index 1637806..b9ac42d 100644
--- a/src/libANGLE/renderer/vulkan/shaders/gen/FullScreenQuad.vert.00000000.inc
+++ b/src/libANGLE/renderer/vulkan/shaders/gen/FullScreenQuad.vert.00000000.inc
Binary files differ
diff --git a/src/libANGLE/renderer/vulkan/shaders/gen/PushConstantColor.frag.00000000.inc b/src/libANGLE/renderer/vulkan/shaders/gen/PushConstantColor.frag.00000000.inc
index 1933d7b..1099917 100644
--- a/src/libANGLE/renderer/vulkan/shaders/gen/PushConstantColor.frag.00000000.inc
+++ b/src/libANGLE/renderer/vulkan/shaders/gen/PushConstantColor.frag.00000000.inc
Binary files differ
diff --git a/src/libANGLE/renderer/vulkan/vk_helpers.cpp b/src/libANGLE/renderer/vulkan/vk_helpers.cpp
index 08bc78d..afe17d9 100644
--- a/src/libANGLE/renderer/vulkan/vk_helpers.cpp
+++ b/src/libANGLE/renderer/vulkan/vk_helpers.cpp
@@ -777,13 +777,13 @@
 
 angle::Result LineLoopHelper::getIndexBufferForElementArrayBuffer(ContextVk *contextVk,
                                                                   BufferVk *elementArrayBufferVk,
-                                                                  GLenum glIndexType,
+                                                                  gl::DrawElementsType glIndexType,
                                                                   int indexCount,
                                                                   intptr_t elementArrayOffset,
                                                                   VkBuffer *bufferHandleOut,
                                                                   VkDeviceSize *bufferOffsetOut)
 {
-    if (glIndexType == GL_UNSIGNED_BYTE)
+    if (glIndexType == gl::DrawElementsType::UnsignedByte)
     {
         // Needed before reading buffer or we could get stale data.
         ANGLE_TRY(contextVk->getRenderer()->finish(contextVk));
@@ -797,7 +797,7 @@
         return angle::Result::Continue();
     }
 
-    VkIndexType indexType = gl_vk::GetIndexType(glIndexType);
+    VkIndexType indexType = gl_vk::kIndexTypeMap[glIndexType];
     ASSERT(indexType == VK_INDEX_TYPE_UINT16 || indexType == VK_INDEX_TYPE_UINT32);
     uint32_t *indices = nullptr;
 
@@ -825,13 +825,13 @@
 }
 
 angle::Result LineLoopHelper::streamIndices(ContextVk *contextVk,
-                                            GLenum glIndexType,
+                                            gl::DrawElementsType glIndexType,
                                             GLsizei indexCount,
                                             const uint8_t *srcPtr,
                                             VkBuffer *bufferHandleOut,
                                             VkDeviceSize *bufferOffsetOut)
 {
-    VkIndexType indexType = gl_vk::GetIndexType(glIndexType);
+    VkIndexType indexType = gl_vk::kIndexTypeMap[glIndexType];
 
     uint8_t *indices = nullptr;
 
@@ -841,7 +841,7 @@
                                            reinterpret_cast<uint8_t **>(&indices), bufferHandleOut,
                                            bufferOffsetOut, nullptr));
 
-    if (glIndexType == GL_UNSIGNED_BYTE)
+    if (glIndexType == gl::DrawElementsType::UnsignedByte)
     {
         // Vulkan doesn't support uint8 index types, so we need to emulate it.
         ASSERT(indexType == VK_INDEX_TYPE_UINT16);
diff --git a/src/libANGLE/renderer/vulkan/vk_helpers.h b/src/libANGLE/renderer/vulkan/vk_helpers.h
index 869ebac..ce6a9ea 100644
--- a/src/libANGLE/renderer/vulkan/vk_helpers.h
+++ b/src/libANGLE/renderer/vulkan/vk_helpers.h
@@ -351,14 +351,14 @@
 
     angle::Result getIndexBufferForElementArrayBuffer(ContextVk *contextVk,
                                                       BufferVk *elementArrayBufferVk,
-                                                      GLenum glIndexType,
+                                                      gl::DrawElementsType glIndexType,
                                                       int indexCount,
                                                       intptr_t elementArrayOffset,
                                                       VkBuffer *bufferHandleOut,
                                                       VkDeviceSize *bufferOffsetOut);
 
     angle::Result streamIndices(ContextVk *contextVk,
-                                GLenum glIndexType,
+                                gl::DrawElementsType glIndexType,
                                 GLsizei indexCount,
                                 const uint8_t *srcPtr,
                                 VkBuffer *bufferHandleOut,
diff --git a/src/libANGLE/renderer/vulkan/vk_utils.cpp b/src/libANGLE/renderer/vulkan/vk_utils.cpp
index 2f00580..e95a89a 100644
--- a/src/libANGLE/renderer/vulkan/vk_utils.cpp
+++ b/src/libANGLE/renderer/vulkan/vk_utils.cpp
@@ -1462,21 +1462,6 @@
     }
 }
 
-VkIndexType GetIndexType(GLenum elementType)
-{
-    switch (elementType)
-    {
-        case GL_UNSIGNED_BYTE:
-        case GL_UNSIGNED_SHORT:
-            return VK_INDEX_TYPE_UINT16;
-        case GL_UNSIGNED_INT:
-            return VK_INDEX_TYPE_UINT32;
-        default:
-            UNREACHABLE();
-            return VK_INDEX_TYPE_MAX_ENUM;
-    }
-}
-
 void GetOffset(const gl::Offset &glOffset, VkOffset3D *vkOffset)
 {
     vkOffset->x = glOffset.x;
diff --git a/src/libANGLE/renderer/vulkan/vk_utils.h b/src/libANGLE/renderer/vulkan/vk_utils.h
index 90a724e..30b1532 100644
--- a/src/libANGLE/renderer/vulkan/vk_utils.h
+++ b/src/libANGLE/renderer/vulkan/vk_utils.h
@@ -865,7 +865,13 @@
 VkFrontFace GetFrontFace(GLenum frontFace, bool invertCullFace);
 VkSampleCountFlagBits GetSamples(GLint sampleCount);
 VkComponentSwizzle GetSwizzle(const GLenum swizzle);
-VkIndexType GetIndexType(GLenum elementType);
+
+constexpr angle::PackedEnumMap<gl::DrawElementsType, VkIndexType> kIndexTypeMap = {
+    {gl::DrawElementsType::UnsignedByte, VK_INDEX_TYPE_UINT16},
+    {gl::DrawElementsType::UnsignedShort, VK_INDEX_TYPE_UINT16},
+    {gl::DrawElementsType::UnsignedInt, VK_INDEX_TYPE_UINT32},
+};
+
 void GetOffset(const gl::Offset &glOffset, VkOffset3D *vkOffset);
 void GetExtent(const gl::Extents &glExtent, VkExtent3D *vkExtent);
 VkImageType GetImageType(gl::TextureType textureType);