Typeify ColorAttachmentIndex

Also moves BindingNumber, BindGroupIndex, and BindingIndex to
IntegerTypes.h. Future TypedIntegers should be declared here.

Bug: dawn:442
Change-Id: I5ba8de3412fb48b7957b67e7c413a5097f8ec00f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/27880
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
diff --git a/src/dawn_native/opengl/RenderPipelineGL.cpp b/src/dawn_native/opengl/RenderPipelineGL.cpp
index 7c70396..10add8c 100644
--- a/src/dawn_native/opengl/RenderPipelineGL.cpp
+++ b/src/dawn_native/opengl/RenderPipelineGL.cpp
@@ -109,21 +109,23 @@
         }
 
         void ApplyColorState(const OpenGLFunctions& gl,
-                             uint32_t attachment,
+                             ColorAttachmentIndex attachment,
                              const ColorStateDescriptor* descriptor) {
+            GLuint colorBuffer = static_cast<GLuint>(static_cast<uint8_t>(attachment));
             if (BlendEnabled(descriptor)) {
-                gl.Enablei(GL_BLEND, attachment);
-                gl.BlendEquationSeparatei(attachment, GLBlendMode(descriptor->colorBlend.operation),
+                gl.Enablei(GL_BLEND, colorBuffer);
+                gl.BlendEquationSeparatei(colorBuffer,
+                                          GLBlendMode(descriptor->colorBlend.operation),
                                           GLBlendMode(descriptor->alphaBlend.operation));
-                gl.BlendFuncSeparatei(attachment,
+                gl.BlendFuncSeparatei(colorBuffer,
                                       GLBlendFactor(descriptor->colorBlend.srcFactor, false),
                                       GLBlendFactor(descriptor->colorBlend.dstFactor, false),
                                       GLBlendFactor(descriptor->alphaBlend.srcFactor, true),
                                       GLBlendFactor(descriptor->alphaBlend.dstFactor, true));
             } else {
-                gl.Disablei(GL_BLEND, attachment);
+                gl.Disablei(GL_BLEND, colorBuffer);
             }
-            gl.ColorMaski(attachment, descriptor->writeMask & wgpu::ColorWriteMask::Red,
+            gl.ColorMaski(colorBuffer, descriptor->writeMask & wgpu::ColorWriteMask::Red,
                           descriptor->writeMask & wgpu::ColorWriteMask::Green,
                           descriptor->writeMask & wgpu::ColorWriteMask::Blue,
                           descriptor->writeMask & wgpu::ColorWriteMask::Alpha);
@@ -265,7 +267,7 @@
             gl.Disable(GL_SAMPLE_ALPHA_TO_COVERAGE);
         }
 
-        for (uint32_t attachmentSlot : IterateBitSet(GetColorAttachmentsMask())) {
+        for (ColorAttachmentIndex attachmentSlot : IterateBitSet(GetColorAttachmentsMask())) {
             ApplyColorState(gl, attachmentSlot, GetColorStateDescriptor(attachmentSlot));
         }
     }