[webkit-dev] WebGL validations

Oliver Hunt oliver at apple.com
Mon Jul 15 08:58:37 PDT 2013

On Jul 15, 2013, at 4:04 AM, SzymanskiPrzemyslaw <p.szymanski3 at samsung.com> wrote:

> Hello.
> Valgrind shows that WebGL performance is lowered by WebGL validation methods like: WebGLRenderingContext::validateRenderingState, WebGLRenderingContext::validateUniformMatrixParameters  or validations in drawElements/drawArrays. Those validations are done in the OpenGL driver. WebKit use those validations mostly for console output.

The validation routines that you're talking are not simple logging functions: they are critical for WebGL to have any semblance of safety.

All of these validation routines have the following basic logic:

bool Thing::validateFoo() {
    if (fooState is valid)
        return true;
    log(foo error)
    return false;

all WebGL functions call the relevant validation functions and then abort if the validation returns false.

This validation is _not_ optional, even the WebGL spec talks about what is necessary.

> I propose to make some setting bool variable like: webgl_validations_enabled = true/false and use it in WebGLRenderingContext.
> So if webgl_validations_enabled = false then WebKit should not validate WebGL and performance will be increased. Typically user doesn’t need those validations. It is helpful only for developers. So they can enable WebGL validations by check webgl_validations_enabled = true.
> In WebKit it is a variable indicating to print messages to console so for WebGL validations this solutions should also works.

Having an option to remove validation simply is not viable - if you wanted you could try to speed up the validation logic, but the validation cannot be dropped.

The validation is needed to achieve a semblance of safety in WebGL and the WebGL spec even specifies what validation must occur, so removing the validation would also result in incorrect behavior (relative to that specified by the spec.  Crashing the browser is also incorrect behavior :D )

> Regards,
> Przemyslaw Szymanski


> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20130715/3c1c2ae8/attachment.html>

More information about the webkit-dev mailing list