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>
This commit is contained in:
Enrico Galli
2020-10-06 08:12:29 +00:00
committed by Commit Bot service account
parent 326e14f34b
commit db2c2dd9b9
9 changed files with 435 additions and 13 deletions

View File

@@ -264,6 +264,19 @@ namespace dawn_native { namespace opengl {
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));
}