[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198
zmo at google.com
zmo at google.com
Mon Feb 21 00:01:24 UTC 2011
The following commit has been merged in the webkit-1.3 branch:
commit 4cdc9803acc7b396e35793bf653774ce1068fb03
Author: zmo at google.com <zmo at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Jan 27 18:58:53 2011 +0000
2011-01-26 Zhenyao Mo <zmo at google.com>
Reviewed by Kenneth Russell.
shaderSource needs to preserve original source
https://bugs.webkit.org/show_bug.cgi?id=52833
* fast/canvas/webgl/gl-getshadersource-expected.txt: Added.
* fast/canvas/webgl/gl-getshadersource.html: Added.
2011-01-26 Zhenyao Mo <zmo at google.com>
Reviewed by Kenneth Russell.
shaderSource needs to preserve original source
https://bugs.webkit.org/show_bug.cgi?id=52833
Test: fast/canvas/webgl/gl-getshadersource.html
* html/canvas/WebGLRenderingContext.cpp:
(WebCore::WebGLRenderingContext::getShaderParameter): Intercept SHADER_SOURCE_LENGTH.
(WebCore::WebGLRenderingContext::getShaderSource): Intercept the call.
(WebCore::WebGLRenderingContext::shaderSource): Cache the source.
* html/canvas/WebGLShader.cpp: Cache shader source.
(WebCore::WebGLShader::WebGLShader):
* html/canvas/WebGLShader.h: Ditto.
(WebCore::WebGLShader::getSource):
(WebCore::WebGLShader::setSource):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76814 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 47bf5a6..302d43d 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2011-01-26 Zhenyao Mo <zmo at google.com>
+
+ Reviewed by Kenneth Russell.
+
+ shaderSource needs to preserve original source
+ https://bugs.webkit.org/show_bug.cgi?id=52833
+
+ * fast/canvas/webgl/gl-getshadersource-expected.txt: Added.
+ * fast/canvas/webgl/gl-getshadersource.html: Added.
+
2011-01-27 Philippe Normand <pnormand at igalia.com>
Unreviewed, skip flaky test, needs further investigation on the failure.
diff --git a/LayoutTests/fast/canvas/webgl/gl-getshadersource-expected.txt b/LayoutTests/fast/canvas/webgl/gl-getshadersource-expected.txt
new file mode 100644
index 0000000..8d1f57b
--- /dev/null
+++ b/LayoutTests/fast/canvas/webgl/gl-getshadersource-expected.txt
@@ -0,0 +1,12 @@
+Tests that the source that goes into a shader is what comes out.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+PASS sourceLength is 0
+PASS source is original
+PASS sourceLength is 17
+PASS getError was expected value: NO_ERROR : Should be no errors.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/canvas/webgl/gl-getshadersource.html b/LayoutTests/fast/canvas/webgl/gl-getshadersource.html
new file mode 100644
index 0000000..53739f2
--- /dev/null
+++ b/LayoutTests/fast/canvas/webgl/gl-getshadersource.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
+ <title>WebGL getShaderSource conformance test.</title>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css"/>
+<script src="../../js/resources/js-test-pre.js"></script>
+<script src="resources/webgl-test.js"> </script>
+<script src="resources/webgl-test-utils.js"> </script>
+</head>
+<body>
+<canvas id="example" width="4" height="4" style="width: 40px; height: 30px;"></canvas>
+<div id="description"></div>
+<div id="console"></div>
+<script id="vshader" type="x-shader/x-vertex">abc//defNOTASCII</script>
+<script>
+description("Tests that the source that goes into a shader is what comes out.");
+var wtu = WebGLTestUtils;
+var canvas = document.getElementById("example");
+var gl = wtu.create3DContext(canvas);
+var original = document.getElementById("vshader").text;
+var shader = gl.createShader(gl.VERTEX_SHADER);
+var sourceLength = gl.getShaderParameter(shader, gl.SHADER_SOURCE_LENGTH);
+shouldBe("sourceLength", "0");
+gl.shaderSource(shader, original);
+var source = gl.getShaderSource(shader);
+shouldBe("source", "original");
+sourceLength = gl.getShaderParameter(shader, gl.SHADER_SOURCE_LENGTH);
+shouldBe("sourceLength", "17");
+successfullyParsed = true;
+glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors.");
+</script>
+</body>
+</body>
+<script src="../../js/resources/js-test-post.js"></script>
+
+<script>
+</script>
+
+</body>
+</html>
+
+
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 2f0a2ac..98a6932 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,22 @@
+2011-01-26 Zhenyao Mo <zmo at google.com>
+
+ Reviewed by Kenneth Russell.
+
+ shaderSource needs to preserve original source
+ https://bugs.webkit.org/show_bug.cgi?id=52833
+
+ Test: fast/canvas/webgl/gl-getshadersource.html
+
+ * html/canvas/WebGLRenderingContext.cpp:
+ (WebCore::WebGLRenderingContext::getShaderParameter): Intercept SHADER_SOURCE_LENGTH.
+ (WebCore::WebGLRenderingContext::getShaderSource): Intercept the call.
+ (WebCore::WebGLRenderingContext::shaderSource): Cache the source.
+ * html/canvas/WebGLShader.cpp: Cache shader source.
+ (WebCore::WebGLShader::WebGLShader):
+ * html/canvas/WebGLShader.h: Ditto.
+ (WebCore::WebGLShader::getSource):
+ (WebCore::WebGLShader::setSource):
+
2011-01-27 Patrick Gansterer <paroga at webkit.org>
Unreviewed WinCE build fix for r76743.
diff --git a/Source/WebCore/html/canvas/WebGLRenderingContext.cpp b/Source/WebCore/html/canvas/WebGLRenderingContext.cpp
index ad8cb19..f4004f2 100644
--- a/Source/WebCore/html/canvas/WebGLRenderingContext.cpp
+++ b/Source/WebCore/html/canvas/WebGLRenderingContext.cpp
@@ -2164,9 +2164,13 @@ WebGLGetInfo WebGLRenderingContext::getShaderParameter(WebGLShader* shader, GC3D
m_context->getShaderiv(objectOrZero(shader), pname, &value);
return WebGLGetInfo(static_cast<unsigned int>(value));
case GraphicsContext3D::INFO_LOG_LENGTH:
- case GraphicsContext3D::SHADER_SOURCE_LENGTH:
m_context->getShaderiv(objectOrZero(shader), pname, &value);
return WebGLGetInfo(value);
+ case GraphicsContext3D::SHADER_SOURCE_LENGTH:
+ value = static_cast<GC3Dint>(shader->getSource().length());
+ if (value > 0)
+ value++; // Includes the null termination character.
+ return WebGLGetInfo(value);
default:
m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM);
return WebGLGetInfo();
@@ -2191,8 +2195,7 @@ String WebGLRenderingContext::getShaderSource(WebGLShader* shader, ExceptionCode
return String();
if (!validateWebGLObject(shader))
return "";
- WebGLStateRestorer(this, false);
- return m_context->getShaderSource(objectOrZero(shader));
+ return shader->getSource();
}
Vector<String> WebGLRenderingContext::getSupportedExtensions()
@@ -2772,6 +2775,7 @@ void WebGLRenderingContext::shaderSource(WebGLShader* shader, const String& stri
String stringWithoutComments = StripComments(string).result();
if (!validateString(stringWithoutComments))
return;
+ shader->setSource(string);
m_context->shaderSource(objectOrZero(shader), stringWithoutComments);
cleanupAfterGraphicsCall(false);
}
diff --git a/Source/WebCore/html/canvas/WebGLShader.cpp b/Source/WebCore/html/canvas/WebGLShader.cpp
index edd5a53..59695e4 100644
--- a/Source/WebCore/html/canvas/WebGLShader.cpp
+++ b/Source/WebCore/html/canvas/WebGLShader.cpp
@@ -41,6 +41,7 @@ PassRefPtr<WebGLShader> WebGLShader::create(WebGLRenderingContext* ctx, GC3Denum
WebGLShader::WebGLShader(WebGLRenderingContext* ctx, GC3Denum type)
: WebGLObject(ctx)
, m_type(type)
+ , m_source("")
{
setObject(context()->graphicsContext3D()->createShader(type));
}
diff --git a/Source/WebCore/html/canvas/WebGLShader.h b/Source/WebCore/html/canvas/WebGLShader.h
index 5deaf20..1d7a10c 100644
--- a/Source/WebCore/html/canvas/WebGLShader.h
+++ b/Source/WebCore/html/canvas/WebGLShader.h
@@ -40,6 +40,9 @@ public:
static PassRefPtr<WebGLShader> create(WebGLRenderingContext*, GC3Denum);
GC3Denum getType() const { return m_type; }
+ const String& getSource() const { return m_source; }
+
+ void setSource(const String& source) { m_source = source; }
private:
WebGLShader(WebGLRenderingContext*, GC3Denum);
@@ -49,6 +52,7 @@ private:
virtual bool isShader() const { return true; }
GC3Denum m_type;
+ String m_source;
};
} // namespace WebCore
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list