Enable viewport tests on OpenGL ES.

Also implement a workaround for missing glViewportIndexedf().

BUG=dawn:580,dawn:597

Change-Id: I618161ae9750925c1c892123607db84563f0869c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/34721
Commit-Queue: Stephen White <senorblanco@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Stephen White 2020-12-03 17:00:33 +00:00 committed by Commit Bot service account
parent 600f6f55db
commit c34bb0c3c4
3 changed files with 11 additions and 1 deletions

View File

@ -1173,7 +1173,15 @@ namespace dawn_native { namespace opengl {
case Command::SetViewport: { case Command::SetViewport: {
SetViewportCmd* cmd = mCommands.NextCommand<SetViewportCmd>(); SetViewportCmd* cmd = mCommands.NextCommand<SetViewportCmd>();
gl.ViewportIndexedf(0, cmd->x, cmd->y, cmd->width, cmd->height); if (gl.IsAtLeastGL(4, 1)) {
gl.ViewportIndexedf(0, cmd->x, cmd->y, cmd->width, cmd->height);
} else {
// Floating-point viewport coords are unsupported on OpenGL ES, but
// truncation is ok because other APIs do not guarantee subpixel precision
// either.
gl.Viewport(static_cast<int>(cmd->x), static_cast<int>(cmd->y),
static_cast<int>(cmd->width), static_cast<int>(cmd->height));
}
gl.DepthRangef(cmd->minDepth, cmd->maxDepth); gl.DepthRangef(cmd->minDepth, cmd->maxDepth);
break; break;
} }

View File

@ -68,4 +68,5 @@ DAWN_INSTANTIATE_TEST(ViewportOrientationTests,
D3D12Backend(), D3D12Backend(),
MetalBackend(), MetalBackend(),
OpenGLBackend(), OpenGLBackend(),
OpenGLESBackend(),
VulkanBackend()); VulkanBackend());

View File

@ -213,4 +213,5 @@ DAWN_INSTANTIATE_TEST(ViewportTest,
D3D12Backend(), D3D12Backend(),
MetalBackend(), MetalBackend(),
OpenGLBackend(), OpenGLBackend(),
OpenGLESBackend(),
VulkanBackend()); VulkanBackend());