Skip to content

Commit

Permalink
2010-10-18 Adrienne Walker <enne@google.com>
Browse files Browse the repository at this point in the history
        Reviewed by Kenneth Russell.

        Update context attribute conformance test from updated Khronos source.
        https://bugs.webkit.org/show_bug.cgi?id=47697

        * fast/canvas/webgl/context-attributes-alpha-depth-stencil-antialias-expected.txt:
        * fast/canvas/webgl/context-attributes-alpha-depth-stencil-antialias.html:
        * platform/chromium/test_expectations.txt:
2010-10-18  Adrienne Walker  <enne@google.com>

        Reviewed by Kenneth Russell.

        Turn off antialiasing when using Mesa during testing.
        https://bugs.webkit.org/show_bug.cgi?id=47697

        * src/WebGraphicsContext3DDefaultImpl.cpp:
        (WebKit::WebGraphicsContext3DDefaultImpl::validateAttributes):

Canonical link: https://commits.webkit.org/60561@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@69996 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
webkit-commit-queue committed Oct 18, 2010
1 parent 28fda49 commit a68219e
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 72 deletions.
11 changes: 11 additions & 0 deletions LayoutTests/ChangeLog
@@ -1,3 +1,14 @@
2010-10-18 Adrienne Walker <enne@google.com>

Reviewed by Kenneth Russell.

Update context attribute conformance test from updated Khronos source.
https://bugs.webkit.org/show_bug.cgi?id=47697

* fast/canvas/webgl/context-attributes-alpha-depth-stencil-antialias-expected.txt:
* fast/canvas/webgl/context-attributes-alpha-depth-stencil-antialias.html:
* platform/chromium/test_expectations.txt:

2010-10-18 Johnny Ding <jnd@chromium.org>

Reviewed by Adam Barth.
Expand Down
Expand Up @@ -6,73 +6,75 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
Testing alpha = true
PASS webGL = getWebGL('alphaOn', { alpha: true, depth: false, stencil: false, antialias: false }, [ 0, 0, 0, 0 ], 1, 0) is non-null.
PASS contextAttribs = webGL.getContextAttributes() is non-null.
PASS contextAttribs.alpha is true
PASS contextAttribs.depth is false
PASS contextAttribs.stencil is false
PASS contextAttribs.antialias is false
PASS contextAttribs.premultipliedAlpha is true
PASS contextAttribs.alpha is non-null.
PASS contextAttribs.depth is non-null.
PASS contextAttribs.stencil is non-null.
PASS contextAttribs.antialias is non-null.
PASS contextAttribs.premultipliedAlpha is non-null.
PASS pixel is correctColor
Testing alpha = false
PASS webGL = getWebGL('alphaOff', { alpha: false, depth: false, stencil: false, antialias: false }, [ 0, 0, 0, 0 ], 1, 0) is non-null.
PASS contextAttribs = webGL.getContextAttributes() is non-null.
PASS contextAttribs.alpha is false
PASS contextAttribs.depth is false
PASS contextAttribs.stencil is false
PASS contextAttribs.antialias is false
PASS contextAttribs.premultipliedAlpha is true
PASS contextAttribs.alpha is non-null.
PASS contextAttribs.depth is non-null.
PASS contextAttribs.stencil is non-null.
PASS contextAttribs.antialias is non-null.
PASS contextAttribs.premultipliedAlpha is non-null.
PASS pixel is correctColor
Testing depth = true
PASS webGL = getWebGL('depthOn', { stencil: false, antialias: false }, [ 0, 0, 0, 1 ], 1, 0) is non-null.
PASS contextAttribs = webGL.getContextAttributes() is non-null.
PASS contextAttribs.depth is true
PASS contextAttribs.alpha is true
PASS contextAttribs.stencil is false
PASS contextAttribs.antialias is false
PASS contextAttribs.premultipliedAlpha is true
PASS contextAttribs.depth is non-null.
PASS contextAttribs.alpha is non-null.
PASS contextAttribs.stencil is non-null.
PASS contextAttribs.antialias is non-null.
PASS contextAttribs.premultipliedAlpha is non-null.
PASS pixel is correctColor
Testing depth = false
PASS webGL = getWebGL('depthOff', { depth: false, stencil: false, antialias: false }, [ 0, 0, 0, 1 ], 1, 0) is non-null.
PASS contextAttribs = webGL.getContextAttributes() is non-null.
PASS contextAttribs.depth is false
PASS contextAttribs.alpha is true
PASS contextAttribs.stencil is false
PASS contextAttribs.antialias is false
PASS contextAttribs.premultipliedAlpha is true
PASS contextAttribs.depth is non-null.
PASS contextAttribs.alpha is non-null.
PASS contextAttribs.stencil is non-null.
PASS contextAttribs.antialias is non-null.
PASS contextAttribs.premultipliedAlpha is non-null.
PASS pixel is correctColor
Testing stencil = true
PASS webGL = getWebGL('stencilOn', { depth: false, stencil: true, antialias: false }, [ 0, 0, 0, 1 ], 1, 0) is non-null.
PASS contextAttribs = webGL.getContextAttributes() is non-null.
PASS contextAttribs.depth == contextAttribs.stencil is true
PASS contextAttribs.alpha is true
PASS contextAttribs.antialias is false
PASS contextAttribs.premultipliedAlpha is true
PASS contextAttribs.depth is non-null.
PASS contextAttribs.alpha is non-null.
PASS contextAttribs.stencil is non-null.
PASS contextAttribs.antialias is non-null.
PASS contextAttribs.premultipliedAlpha is non-null.
PASS pixel is correctColor
Testing stencil = false
PASS webGL = getWebGL('stencilOff', { depth: false, stencil: false, antialias: false }, [ 0, 0, 0, 1 ], 1, 0) is non-null.
PASS contextAttribs = webGL.getContextAttributes() is non-null.
PASS contextAttribs.depth == contextAttribs.stencil is true
PASS contextAttribs.alpha is true
PASS contextAttribs.antialias is false
PASS contextAttribs.premultipliedAlpha is true
PASS contextAttribs.depth is non-null.
PASS contextAttribs.alpha is non-null.
PASS contextAttribs.stencil is non-null.
PASS contextAttribs.antialias is non-null.
PASS contextAttribs.premultipliedAlpha is non-null.
PASS pixel is correctColor
Testing antialias = true
PASS webGL = getWebGL('antialiasOn', { depth: false, stencil: false, alpha: false, antialias: true }, [ 0, 0, 0, 1 ], 1, 0) is non-null.
PASS contextAttribs = webGL.getContextAttributes() is non-null.
PASS contextAttribs.depth is false
PASS contextAttribs.stencil is false
PASS contextAttribs.alpha is false
PASS contextAttribs.antialias == true || contextAttribs.antialias == false is true
PASS contextAttribs.premultipliedAlpha is true
PASS pixel[0] == 255 || pixel[0] == 0 is false
PASS contextAttribs.depth is non-null.
PASS contextAttribs.alpha is non-null.
PASS contextAttribs.stencil is non-null.
PASS contextAttribs.antialias is non-null.
PASS contextAttribs.premultipliedAlpha is non-null.
PASS pixel[0] != 255 && pixel[0] != 0 is contextAttribs.antialias
Testing antialias = false
PASS webGL = getWebGL('antialiasOff', { depth: false, stencil: false, alpha: false, antialias: false }, [ 0, 0, 0, 1 ], 1, 0) is non-null.
PASS contextAttribs = webGL.getContextAttributes() is non-null.
PASS contextAttribs.depth is false
PASS contextAttribs.stencil is false
PASS contextAttribs.alpha is false
PASS contextAttribs.antialias == true || contextAttribs.antialias == false is true
PASS contextAttribs.premultipliedAlpha is true
PASS pixel[0] == 255 || pixel[0] == 0 is true
PASS contextAttribs.depth is non-null.
PASS contextAttribs.alpha is non-null.
PASS contextAttribs.stencil is non-null.
PASS contextAttribs.antialias is non-null.
PASS contextAttribs.premultipliedAlpha is non-null.
PASS pixel[0] != 255 && pixel[0] != 0 is contextAttribs.antialias
PASS successfullyParsed is true

TEST COMPLETE
Expand Down
Expand Up @@ -55,7 +55,6 @@
alert("No WebGL context found");
return null;
}
var actualContextAttribs = gl.getContextAttributes();

// Add a console
gl.console = ("console" in window) ? window.console : { log: function() { } };
Expand Down Expand Up @@ -141,19 +140,19 @@
else
shouldBeNonNull("webGL = getWebGL('alphaOff', { alpha: false, depth: false, stencil: false, antialias: false }, [ 0, 0, 0, 0 ], 1, 0)");
shouldBeNonNull("contextAttribs = webGL.getContextAttributes()");
shouldBe("contextAttribs.alpha", (alpha ? "true" : "false"));
shouldBe("contextAttribs.depth", "false");
shouldBe("contextAttribs.stencil", "false");
shouldBe("contextAttribs.antialias", "false");
shouldBe("contextAttribs.premultipliedAlpha", "true");
shouldBeNonNull("contextAttribs.alpha");
shouldBeNonNull("contextAttribs.depth");
shouldBeNonNull("contextAttribs.stencil");
shouldBeNonNull("contextAttribs.antialias");
shouldBeNonNull("contextAttribs.premultipliedAlpha");

var buf = new Uint8Array(1 * 1 * 4);
webGL.readPixels(0, 0, 1, 1, webGL.RGBA, webGL.UNSIGNED_BYTE, buf);
pixel[0] = buf[0];
pixel[1] = buf[1];
pixel[2] = buf[2];
pixel[3] = buf[3];
correctColor = (alpha ? [0, 0, 0, 0] : [0, 0, 0, 255]);
correctColor = (contextAttribs.alpha ? [0, 0, 0, 0] : [0, 0, 0, 255]);
shouldBe("pixel", "correctColor");
}

Expand All @@ -165,11 +164,11 @@
else
shouldBeNonNull("webGL = getWebGL('depthOff', { depth: false, stencil: false, antialias: false }, [ 0, 0, 0, 1 ], 1, 0)");
shouldBeNonNull("contextAttribs = webGL.getContextAttributes()");
shouldBe("contextAttribs.depth", (depth ? "true" : "false"));
shouldBe("contextAttribs.alpha", "true");
shouldBe("contextAttribs.stencil", "false");
shouldBe("contextAttribs.antialias", "false");
shouldBe("contextAttribs.premultipliedAlpha", "true");
shouldBeNonNull("contextAttribs.depth");
shouldBeNonNull("contextAttribs.alpha");
shouldBeNonNull("contextAttribs.stencil");
shouldBeNonNull("contextAttribs.antialias");
shouldBeNonNull("contextAttribs.premultipliedAlpha");

webGL.depthFunc(webGL.NEVER);

Expand All @@ -193,7 +192,7 @@
pixel[1] = buf[1];
pixel[2] = buf[2];
pixel[3] = buf[3];
correctColor = (depth ? [0, 0, 0, 255] : [255, 0, 0, 255]);
correctColor = (contextAttribs.depth ? [0, 0, 0, 255] : [255, 0, 0, 255]);
shouldBe("pixel", "correctColor");
}

Expand All @@ -205,11 +204,11 @@
else
shouldBeNonNull("webGL = getWebGL('stencilOff', { depth: false, stencil: false, antialias: false }, [ 0, 0, 0, 1 ], 1, 0)");
shouldBeNonNull("contextAttribs = webGL.getContextAttributes()");
// If EXT_packed_depth_stencil is supported, both depth & stencil will be true; otherwise, both will be false.
shouldBe("contextAttribs.depth == contextAttribs.stencil", "true");
shouldBe("contextAttribs.alpha", "true");
shouldBe("contextAttribs.antialias", "false");
shouldBe("contextAttribs.premultipliedAlpha", "true");
shouldBeNonNull("contextAttribs.depth");
shouldBeNonNull("contextAttribs.alpha");
shouldBeNonNull("contextAttribs.stencil");
shouldBeNonNull("contextAttribs.antialias");
shouldBeNonNull("contextAttribs.premultipliedAlpha");

webGL.depthFunc(webGL.ALWAYS);

Expand All @@ -236,10 +235,7 @@
pixel[1] = buf[1];
pixel[2] = buf[2];
pixel[3] = buf[3];
correctColor = (stencil ? [0, 0, 0, 255] : [255, 0, 0, 255]);
// If stencil is requested but not supported, we fake the effect.
if (stencil && !contextAttribs.stencil)
pixel[0] = 0;
correctColor = (contextAttribs.stencil ? [0, 0, 0, 255] : [255, 0, 0, 255]);
shouldBe("pixel", "correctColor");
}

Expand All @@ -251,11 +247,11 @@
else
shouldBeNonNull("webGL = getWebGL('antialiasOff', { depth: false, stencil: false, alpha: false, antialias: false }, [ 0, 0, 0, 1 ], 1, 0)");
shouldBeNonNull("contextAttribs = webGL.getContextAttributes()");
shouldBe("contextAttribs.depth", "false");
shouldBe("contextAttribs.stencil", "false");
shouldBe("contextAttribs.alpha", "false");
shouldBe("contextAttribs.antialias == true || contextAttribs.antialias == false", "true");
shouldBe("contextAttribs.premultipliedAlpha", "true");
shouldBeNonNull("contextAttribs.depth");
shouldBeNonNull("contextAttribs.alpha");
shouldBeNonNull("contextAttribs.stencil");
shouldBeNonNull("contextAttribs.antialias");
shouldBeNonNull("contextAttribs.premultipliedAlpha");

var vertices = new Float32Array([
1.0, 1.0, 0.0,
Expand All @@ -267,10 +263,7 @@
255, 0, 0, 255]);
var buf = drawAndReadPixel(webGL, vertices, colors, 0, 0);
pixel[0] = buf[0];
// If antialias is requested but not supported, we fake the effect.
if (antialias && !contextAttribs.antialias)
pixel[0] = 127;
shouldBe("pixel[0] == 255 || pixel[0] == 0", (antialias ? "false" : "true"));
shouldBe("pixel[0] != 255 && pixel[0] != 0", "contextAttribs.antialias");
}

function runTest()
Expand Down
1 change: 0 additions & 1 deletion LayoutTests/platform/chromium/test_expectations.txt
Expand Up @@ -3050,7 +3050,6 @@ BUGDPRANKE WIN LINUX : media/video-poster.html = PASS TEXT

BUGWK45898 : editing/selection/context-menu-on-text.html = TEXT

BUGWEBGL WIN LINUX : fast/canvas/webgl/context-attributes-alpha-depth-stencil-antialias.html = TEXT
BUGWEBGL : fast/canvas/webgl/css-webkit-canvas-repaint.html = IMAGE
BUGWEBGL : fast/canvas/webgl/css-webkit-canvas.html = IMAGE
BUGWEBGL WIN MAC : fast/canvas/webgl/tex-image-and-sub-image-2d-with-video.html = TEXT PASS
Expand Down
10 changes: 10 additions & 0 deletions WebKit/chromium/ChangeLog
@@ -1,3 +1,13 @@
2010-10-18 Adrienne Walker <enne@google.com>

Reviewed by Kenneth Russell.

Turn off antialiasing when using Mesa during testing.
https://bugs.webkit.org/show_bug.cgi?id=47697

* src/WebGraphicsContext3DDefaultImpl.cpp:
(WebKit::WebGraphicsContext3DDefaultImpl::validateAttributes):

2010-10-18 James Robinson <jamesr@chromium.org>

Update the chromium DEPS from 62399 to 62813 to pick up skia fixes
Expand Down
6 changes: 6 additions & 0 deletions WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp
Expand Up @@ -196,6 +196,12 @@ void WebGraphicsContext3DDefaultImpl::validateAttributes()
#endif
if (!isValidVendor || !strstr(extensions, "GL_EXT_framebuffer_multisample"))
m_attributes.antialias = false;

// Don't antialias when using Mesa to ensure more reliable testing and
// because it doesn't appear to multisample straight lines correctly.
const char* renderer = reinterpret_cast<const char*>(glGetString(GL_RENDERER));
if (!strncmp(renderer, "Mesa", 4))
m_attributes.antialias = false;
}
// FIXME: instead of enforcing premultipliedAlpha = true, implement the
// correct behavior when premultipliedAlpha = false is requested.
Expand Down

0 comments on commit a68219e

Please sign in to comment.