[Piglit] [PATCH 2/2] variable-index-write.sh: extend to support glsl es 1.00
Tom Gall
tom.gall at linaro.org
Wed Mar 20 15:15:29 PDT 2013
>From tests/spec/glsl-1.10 extend variable-index-write.sh so that
it can also correctly generates variable index write tests that
support glsl-es-1.00.
1.00 added as a valid parameter to generated tests for glsl-es-1.00.
For 1.00 tests in the vertex shader an orthographic projection is
applied since ortho during the test portion isn't supported on
OpenGL ES.
For 1.00 tests the fragent shader specifies default precision.
For 1.00 tests emit in the [require] section the correct
GLSL ES and GL ES settings.
Signed-off-by: Tom Gall <tom.gall at linaro.org>
---
tests/spec/glsl-1.10/variable-index-write.sh | 67 +++++++++++++++++++++++---
1 file changed, 61 insertions(+), 6 deletions(-)
diff --git a/tests/spec/glsl-1.10/variable-index-write.sh b/tests/spec/glsl-1.10/variable-index-write.sh
index 96a4791..06802c4 100755
--- a/tests/spec/glsl-1.10/variable-index-write.sh
+++ b/tests/spec/glsl-1.10/variable-index-write.sh
@@ -177,6 +177,10 @@ function emit_fs
fi
echo "[fragment shader]"
+ if [ $v -eq 100 ]; then
+ echo "precision highp float;"
+ echo "precision highp int;"
+ fi
emit_globals $*
@@ -207,14 +211,24 @@ function emit_test_vectors
index_value=$4
col=$5
value_type=$6
+ v=${version/./}
- cat <<EOF
+ if [ "$v" -eq 100 ]; then
+ cat <<EOF
+[test]
+clear color 0.5 0.5 0.5 0.5
+clear
+
+EOF
+ else
+ cat <<EOF
[test]
clear color 0.5 0.5 0.5 0.5
clear
ortho
EOF
+ fi
# NOTE: shader_runner uses the matCxR names even for GLSL 1.10
type="mat${matrix_dim}x${matrix_dim}"
@@ -321,15 +335,37 @@ EOF
function emit_fs_wr_test
{
+ v=${version/./}
+
echo "# Test generated by:"
echo "# ${cmd}"
echo
echo "[require]"
- echo "GLSL >= ${version}"
+ if [ "$v" -eq 100 ]; then
+ echo "GLSL ES >= ${version}"
+ echo "GL ES >= 2.0"
+ else
+ echo "GLSL >= ${version}"
+ fi
echo
echo "[vertex shader]"
- echo "void main() { gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; }"
+ if [ "$v" -eq 100 ]; then
+ echo "attribute vec4 vertex;"
+ echo "mat4 projection = mat4("
+ echo " 2.0/250.0, 0.0, 0.0, -1.0,"
+ echo " 0.0, 2.0/250.0, 0.0, -1.0,"
+ echo " 0.0, 0.0, -1.0, 0.0,"
+ echo " 0.0, 0.0, 0.0, 1.0);"
+ echo
+ echo "void main()"
+ echo "{"
+ echo " gl_Position = vertex;"
+ echo " gl_Position *= projection;"
+ echo "}"
+ else
+ echo "void main() { gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; }"
+ fi
echo
emit_fs $*
@@ -342,20 +378,39 @@ function emit_vs_wr_test
matrix_dim=$1
array_dim=$2
mode=$3
+ v=${version/./}
echo "# Test generated by:"
echo "# ${cmd}"
echo
echo "[require]"
- echo "GLSL >= ${version}"
+ if [ "$v" -eq 100 ]; then
+ echo "GLSL ES >= ${version}"
+ echo "GL ES >= 2.0"
+ else
+ echo "GLSL >= ${version}"
+ fi
echo
echo "[vertex shader]"
+ if [ "$v" -eq 100 ]; then
+ echo "attribute vec4 vertex;"
+ echo "mat4 projection = mat4("
+ echo " 2.0/250.0, 0.0, 0.0, -1.0,"
+ echo " 0.0, 2.0/250.0, 0.0, -1.0,"
+ echo " 0.0, 0.0, -1.0, 0.0,"
+ echo " 0.0, 0.0, 0.0, 1.0);"
+ fi
emit_globals $*
echo "void main()"
echo "{"
- echo " gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;"
+ if [ "$v" -eq 100 ]; then
+ echo " gl_Position = vertex;"
+ echo " gl_Position *= projection;"
+ else
+ echo " gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;"
+ fi
echo
emit_set_matrix $*
@@ -387,7 +442,7 @@ if [ "x$1" = "x" ]; then
version="1.10"
else
case "$1" in
- 1.[12]0) version="$1";;
+ 1.[012]0) version="$1";;
*)
echo "Bogus GLSL version \"$1\" specified."
exit 1
--
1.7.10.4
More information about the Piglit
mailing list