[Piglit] [PATCH 2/3] GL_ARB_uniform_buffer_object: Add "ubo" arg to variable-index-*.sh script
Vincent Lejeune
vljn at ovi.com
Sat Mar 24 11:13:50 PDT 2012
---
tests/spec/glsl-1.10/variable-index-read.sh | 36 ++++++++++++++++--
tests/spec/glsl-1.10/variable-index-write.sh | 50 +++++++++++++++++++++++---
2 files changed, 77 insertions(+), 9 deletions(-)
diff --git a/tests/spec/glsl-1.10/variable-index-read.sh b/tests/spec/glsl-1.10/variable-index-read.sh
index b9f342e..193e340 100755
--- a/tests/spec/glsl-1.10/variable-index-read.sh
+++ b/tests/spec/glsl-1.10/variable-index-read.sh
@@ -61,6 +61,10 @@ function emit_globals
fi
fi
+ if [ $ubo -ge 0 ]; then
+ echo "uniform ubo1 {"
+ fi
+
if [ $array_dim -ne 0 -a "x$index_value" = "xindex" ]; then
echo "uniform int index;"
fi
@@ -75,6 +79,10 @@ function emit_globals
echo "uniform ${expect_type} expect;"
+ if [ $ubo -ge 1 ]; then
+ echo "};"
+ fi
+
if [ $v -ge 120 -a "x$mode" = "xuniform" ]; then
if [ $array_dim -eq 0 ]; then
echo -n "${mode} ${type} m = ${type}("
@@ -165,6 +173,9 @@ function emit_vs
echo "[vertex shader]"
echo "#version ${version/./}"
+ if [ $ubo -ge 1 ];then
+ echo "#extension GL_ARB_uniform_buffer_object : enable"
+ fi
emit_globals $*
echo "void main()"
@@ -219,6 +230,9 @@ emit_fs()
echo "[fragment shader]"
echo "#version ${version/./}"
+ if [ $ubo -ge 1 ];then
+ echo "#extension GL_ARB_uniform_buffer_object : enable"
+ fi
emit_globals $*
echo "void main()"
@@ -343,17 +357,30 @@ EOF
x_base=$(((i - 1) * (15 * matrix_dim + 10)))
for c in $columns; do
if [ "x$col" = "xcol" ]; then
- echo "uniform int col $((c - 1))"
+ if [ $ubo -ge 1 ]; then
+ echo "ubo-uniform int col $((c - 1))"
+ else
+ echo "uniform int col $((c - 1))"
+ fi
fi
for r in $rows; do
expect=$(((i - 1) * (matrix_dim * matrix_dim) + (c - 1) * matrix_dim + r))
if [ "x$expect_type" = "xfloat" ]; then
- echo "uniform int row $((r - 1))"
- echo "uniform float expect $expect"
+ if [ $ubo -ge 1 ]; then
+ echo "ubo-uniform int row $((r - 1))"
+ echo "ubo-uniform float expect $expect"
+ else
+ echo "uniform int row $((r - 1))"
+ echo "uniform float expect $expect"
+ fi
else
e=$(seq $expect $((expect + matrix_dim - 1)) | tr '\n' ' ' | sed 's/[[:space:]]*$//g')
- echo "uniform ${expect_type} expect $e"
+ if [ $ubo -ge 1 ]; then
+ echo "ubo-uniform ${expect_type} expect $e"
+ else
+ echo "uniform ${expect_type} expect $e"
+ fi
fi
x=$((x_base + 15 * c - 10))
@@ -411,6 +438,7 @@ if [ "x$1" = "x" ]; then
else
case "$1" in
1.[12]0) version="$1";;
+ ubo) version="1.20"; ubo="1";;
*)
echo "Bogus GLSL version \"$1\" specified."
exit 1
diff --git a/tests/spec/glsl-1.10/variable-index-write.sh b/tests/spec/glsl-1.10/variable-index-write.sh
index c7b2970..10fb07b 100755
--- a/tests/spec/glsl-1.10/variable-index-write.sh
+++ b/tests/spec/glsl-1.10/variable-index-write.sh
@@ -28,6 +28,10 @@ function emit_globals
fi
fi
+ if [ $ubo -ge 0 ]; then
+ echo "uniform ubo1 {"
+ fi
+
echo "uniform ${base_type} src_matrix;"
echo "uniform vec${matrix_dim} v;"
echo "uniform vec${matrix_dim} expect;"
@@ -43,6 +47,10 @@ function emit_globals
echo "uniform int col;"
echo "uniform ${value_type} value;"
+ if [ $ubo -ge 1 ]; then
+ echo "};"
+ fi
+
if [ "x$mode" = "xvarying" ]; then
echo "varying ${type} dst_matrix${dim};"
fi
@@ -178,6 +186,9 @@ function emit_fs
echo "[fragment shader]"
echo "#version ${version/./}"
+ if [ $ubo -ge 1 ];then
+ echo "#extension GL_ARB_uniform_buffer_object : enable"
+ fi
emit_globals $*
@@ -280,18 +291,30 @@ EOF
for i in $sizes; do
if [ $array_dim -ne 0 -a "x$index_value" = "xindex" ]; then
+ if [ $ubo -ge 1 ]; then
+ echo "ubo-uniform int index $((i-1))"
+ else
echo "uniform int index $((i-1))"
+ fi
fi
x_base=$(((i - 1) * (15 * matrix_dim + 10)))
for c in $columns; do
if [ "x$col" = "xcol" ]; then
- echo "uniform int col $((c-1))"
+ if [ $ubo -ge 1 ]; then
+ echo "ubo-uniform int col $((c-1))"
+ else
+ echo "uniform int col $((c-1))"
+ fi
fi
for r in $rows; do
if [ "x$value_type" = "xfloat" ]; then
+ if [ $ubo -ge 1 ]; then
+ echo "ubo-uniform int row $((r-1))"
+ else
echo "uniform int row $((r-1))"
+ fi
fi
d=$((matrix_dim * (c-1) + (r-1) + 1))
@@ -301,10 +324,17 @@ EOF
v=$(echo $mat | cut -d' ' -f$d-$((d+matrix_dim-1)))
fi
- echo "uniform vec${matrix_dim} v ${vec}"
- echo "uniform vec${matrix_dim} expect ${exp}"
- echo "uniform ${type} src_matrix ${mat/$v/$bad}"
- echo "uniform ${value_type} value $v"
+ if [ $ubo -ge 1 ]; then
+ echo "ubo-uniform vec${matrix_dim} v ${vec}"
+ echo "ubo-uniform vec${matrix_dim} expect ${exp}"
+ echo "ubo-uniform ${type} src_matrix ${mat/$v/$bad}"
+ echo "ubo-uniform ${value_type} value $v"
+ else
+ echo "uniform vec${matrix_dim} v ${vec}"
+ echo "uniform vec${matrix_dim} expect ${exp}"
+ echo "uniform ${type} src_matrix ${mat/$v/$bad}"
+ echo "uniform ${value_type} value $v"
+ fi
x=$((x_base + 15 * c - 10))
y=$((15 * r - 10))
@@ -331,6 +361,9 @@ function emit_fs_wr_test
echo "[vertex shader]"
echo "#version ${version/./}"
+ if [ $ubo -ge 1 ];then
+ echo "#extension GL_ARB_uniform_buffer_object : enable"
+ fi
echo "void main() { gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; }"
echo
@@ -354,6 +387,9 @@ function emit_vs_wr_test
echo "[vertex shader]"
echo "#version ${version/./}"
+ if [ $ubo -ge 1 ];then
+ echo "#extension GL_ARB_uniform_buffer_object : enable"
+ fi
emit_globals $*
echo "void main()"
@@ -375,6 +411,9 @@ function emit_vs_wr_test
if [ "x$mode" != "xvarying" ];then
echo "[fragment shader]"
echo "#version ${version/./}"
+ if [ $ubo -ge 1 ];then
+ echo "#extension GL_ARB_uniform_buffer_object : enable"
+ fi
echo "void main() { gl_FragColor = gl_Color; }"
echo
else
@@ -392,6 +431,7 @@ if [ "x$1" = "x" ]; then
else
case "$1" in
1.[12]0) version="$1";;
+ ubo) version="1.20"; ubo="1";;
*)
echo "Bogus GLSL version \"$1\" specified."
exit 1
--
1.7.7
More information about the Piglit
mailing list