mesa: optimize glPopAttrib(GL_VIEWPORT_BIT)

We can just copy the variables because they are already clamped
to ctx->Const limits.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8181>
This commit is contained in:
Marek Olšák 2020-12-19 03:14:01 -05:00
parent a04939662d
commit 6c0a8ddb6f
1 changed files with 12 additions and 3 deletions

View File

@ -1140,9 +1140,18 @@ _mesa_PopAttrib(void)
for (i = 0; i < ctx->Const.MaxViewports; i++) {
const struct gl_viewport_attrib *vp = &attr->Viewport.ViewportArray[i];
_mesa_set_viewport(ctx, i, vp->X, vp->Y, vp->Width,
vp->Height);
_mesa_set_depth_range(ctx, i, vp->Near, vp->Far);
if (memcmp(&ctx->ViewportArray[i].X, &vp->X, sizeof(float) * 6)) {
ctx->NewState |= _NEW_VIEWPORT;
ctx->NewDriverState |= ctx->DriverFlags.NewViewport;
memcpy(&ctx->ViewportArray[i].X, &vp->X, sizeof(float) * 6);
if (ctx->Driver.Viewport)
ctx->Driver.Viewport(ctx);
if (ctx->Driver.DepthRange)
ctx->Driver.DepthRange(ctx);
}
}
if (ctx->Extensions.NV_conservative_raster) {