Add support for depthBias, depthBiasSlope, and depthBiasClamp

Bug: dawn:524
Change-Id: I2586aadbc326f58889314a2d10794bcc0572aaba
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28300
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
diff --git a/src/dawn_native/opengl/RenderPipelineGL.cpp b/src/dawn_native/opengl/RenderPipelineGL.cpp
index bc5882b..828f4cc 100644
--- a/src/dawn_native/opengl/RenderPipelineGL.cpp
+++ b/src/dawn_native/opengl/RenderPipelineGL.cpp
@@ -264,6 +264,19 @@
             gl.Disable(GL_SAMPLE_ALPHA_TO_COVERAGE);
         }
 
+        if (IsDepthBiasEnabled()) {
+            gl.Enable(GL_POLYGON_OFFSET_FILL);
+            float depthBias = GetDepthBias();
+            float slopeScale = GetDepthBiasSlopeScale();
+            if (gl.PolygonOffsetClamp != nullptr) {
+                gl.PolygonOffsetClamp(slopeScale, depthBias, GetDepthBiasClamp());
+            } else {
+                gl.PolygonOffset(slopeScale, depthBias);
+            }
+        } else {
+            gl.Disable(GL_POLYGON_OFFSET_FILL);
+        }
+
         for (ColorAttachmentIndex attachmentSlot : IterateBitSet(GetColorAttachmentsMask())) {
             ApplyColorState(gl, attachmentSlot, GetColorStateDescriptor(attachmentSlot));
         }