summaryrefslogtreecommitdiffstats
path: root/src/gallium/tests
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/tests')
l---------src/gallium/tests/graw/fragment-shader1
-rw-r--r--src/gallium/tests/graw/fragment-shader/frag-abs.sh13
-rw-r--r--src/gallium/tests/graw/fragment-shader/frag-add.sh8
-rw-r--r--src/gallium/tests/graw/fragment-shader/frag-cb-1d.sh13
-rw-r--r--src/gallium/tests/graw/fragment-shader/frag-cb-2d.sh (renamed from src/gallium/tests/python/tests/regress/fragment-shader/frag-cb-2d.sh)0
-rw-r--r--src/gallium/tests/graw/fragment-shader/frag-dp3.sh8
-rw-r--r--src/gallium/tests/graw/fragment-shader/frag-dp4.sh8
-rw-r--r--src/gallium/tests/graw/fragment-shader/frag-dst.sh8
-rw-r--r--src/gallium/tests/graw/fragment-shader/frag-ex2.sh11
-rw-r--r--src/gallium/tests/graw/fragment-shader/frag-face.sh (renamed from src/gallium/tests/python/tests/regress/fragment-shader/frag-face.sh)0
-rw-r--r--src/gallium/tests/graw/fragment-shader/frag-flr.sh15
-rw-r--r--src/gallium/tests/graw/fragment-shader/frag-frc.sh13
-rw-r--r--src/gallium/tests/graw/fragment-shader/frag-kil.sh (renamed from src/gallium/tests/python/tests/regress/fragment-shader/frag-kil.sh)0
-rw-r--r--src/gallium/tests/graw/fragment-shader/frag-lg2.sh15
-rw-r--r--src/gallium/tests/graw/fragment-shader/frag-lit.sh8
-rw-r--r--src/gallium/tests/graw/fragment-shader/frag-lrp.sh11
-rw-r--r--src/gallium/tests/graw/fragment-shader/frag-mad-immx.sh (renamed from src/gallium/tests/python/tests/regress/fragment-shader/frag-mad-immx.sh)0
-rw-r--r--src/gallium/tests/graw/fragment-shader/frag-mad.sh11
-rw-r--r--src/gallium/tests/graw/fragment-shader/frag-max.sh10
-rw-r--r--src/gallium/tests/graw/fragment-shader/frag-min.sh10
-rw-r--r--src/gallium/tests/graw/fragment-shader/frag-mov.sh8
-rw-r--r--src/gallium/tests/graw/fragment-shader/frag-mul.sh10
-rw-r--r--src/gallium/tests/graw/fragment-shader/frag-rcp.sh15
-rw-r--r--src/gallium/tests/graw/fragment-shader/frag-rsq.sh15
-rw-r--r--src/gallium/tests/graw/fragment-shader/frag-sge.sh13
-rw-r--r--src/gallium/tests/graw/fragment-shader/frag-slt.sh13
-rw-r--r--src/gallium/tests/graw/fragment-shader/frag-srcmod-abs.sh13
-rw-r--r--src/gallium/tests/graw/fragment-shader/frag-srcmod-absneg.sh15
-rw-r--r--src/gallium/tests/graw/fragment-shader/frag-srcmod-neg.sh11
-rw-r--r--src/gallium/tests/graw/fragment-shader/frag-srcmod-swz.sh8
-rw-r--r--src/gallium/tests/graw/fragment-shader/frag-sub.sh8
-rw-r--r--src/gallium/tests/graw/fragment-shader/frag-tempx.sh (renamed from src/gallium/tests/python/tests/regress/fragment-shader/frag-tempx.sh)0
-rw-r--r--src/gallium/tests/graw/fragment-shader/frag-xpd.sh8
l---------src/gallium/tests/graw/vertex-shader1
-rw-r--r--src/gallium/tests/graw/vertex-shader/vert-abs.sh (renamed from src/gallium/tests/python/tests/regress/vertex-shader/vert-abs.sh)0
-rw-r--r--src/gallium/tests/graw/vertex-shader/vert-add.sh (renamed from src/gallium/tests/python/tests/regress/vertex-shader/vert-add.sh)0
-rw-r--r--src/gallium/tests/graw/vertex-shader/vert-arl.sh (renamed from src/gallium/tests/python/tests/regress/vertex-shader/vert-arl.sh)0
-rw-r--r--src/gallium/tests/graw/vertex-shader/vert-arr.sh (renamed from src/gallium/tests/python/tests/regress/vertex-shader/vert-arr.sh)0
-rw-r--r--src/gallium/tests/graw/vertex-shader/vert-cb-1d.sh (renamed from src/gallium/tests/python/tests/regress/vertex-shader/vert-cb-1d.sh)0
-rw-r--r--src/gallium/tests/graw/vertex-shader/vert-cb-2d.sh (renamed from src/gallium/tests/python/tests/regress/vertex-shader/vert-cb-2d.sh)0
-rw-r--r--src/gallium/tests/graw/vertex-shader/vert-dp3.sh (renamed from src/gallium/tests/python/tests/regress/vertex-shader/vert-dp3.sh)0
-rw-r--r--src/gallium/tests/graw/vertex-shader/vert-dp4.sh (renamed from src/gallium/tests/python/tests/regress/vertex-shader/vert-dp4.sh)0
-rw-r--r--src/gallium/tests/graw/vertex-shader/vert-dst.sh (renamed from src/gallium/tests/python/tests/regress/vertex-shader/vert-dst.sh)0
-rw-r--r--src/gallium/tests/graw/vertex-shader/vert-ex2.sh (renamed from src/gallium/tests/python/tests/regress/vertex-shader/vert-ex2.sh)0
-rw-r--r--src/gallium/tests/graw/vertex-shader/vert-flr.sh (renamed from src/gallium/tests/python/tests/regress/vertex-shader/vert-flr.sh)0
-rw-r--r--src/gallium/tests/graw/vertex-shader/vert-frc.sh (renamed from src/gallium/tests/python/tests/regress/vertex-shader/vert-frc.sh)0
-rw-r--r--src/gallium/tests/graw/vertex-shader/vert-lg2.sh (renamed from src/gallium/tests/python/tests/regress/vertex-shader/vert-lg2.sh)0
-rw-r--r--src/gallium/tests/graw/vertex-shader/vert-lit.sh (renamed from src/gallium/tests/python/tests/regress/vertex-shader/vert-lit.sh)0
-rw-r--r--src/gallium/tests/graw/vertex-shader/vert-lrp.sh (renamed from src/gallium/tests/python/tests/regress/vertex-shader/vert-lrp.sh)0
-rw-r--r--src/gallium/tests/graw/vertex-shader/vert-mad.sh (renamed from src/gallium/tests/python/tests/regress/vertex-shader/vert-mad.sh)0
-rw-r--r--src/gallium/tests/graw/vertex-shader/vert-max.sh (renamed from src/gallium/tests/python/tests/regress/vertex-shader/vert-max.sh)0
-rw-r--r--src/gallium/tests/graw/vertex-shader/vert-min.sh (renamed from src/gallium/tests/python/tests/regress/vertex-shader/vert-min.sh)0
-rw-r--r--src/gallium/tests/graw/vertex-shader/vert-mov.sh (renamed from src/gallium/tests/python/tests/regress/vertex-shader/vert-mov.sh)0
-rw-r--r--src/gallium/tests/graw/vertex-shader/vert-mul.sh (renamed from src/gallium/tests/python/tests/regress/vertex-shader/vert-mul.sh)0
-rw-r--r--src/gallium/tests/graw/vertex-shader/vert-rcp.sh (renamed from src/gallium/tests/python/tests/regress/vertex-shader/vert-rcp.sh)0
-rw-r--r--src/gallium/tests/graw/vertex-shader/vert-rsq.sh (renamed from src/gallium/tests/python/tests/regress/vertex-shader/vert-rsq.sh)0
-rw-r--r--src/gallium/tests/graw/vertex-shader/vert-sge.sh (renamed from src/gallium/tests/python/tests/regress/vertex-shader/vert-sge.sh)0
-rw-r--r--src/gallium/tests/graw/vertex-shader/vert-slt.sh (renamed from src/gallium/tests/python/tests/regress/vertex-shader/vert-slt.sh)0
-rw-r--r--src/gallium/tests/graw/vertex-shader/vert-srcmod-abs.sh (renamed from src/gallium/tests/python/tests/regress/vertex-shader/vert-srcmod-abs.sh)0
-rw-r--r--src/gallium/tests/graw/vertex-shader/vert-srcmod-absneg.sh (renamed from src/gallium/tests/python/tests/regress/vertex-shader/vert-srcmod-absneg.sh)0
-rw-r--r--src/gallium/tests/graw/vertex-shader/vert-srcmod-neg.sh (renamed from src/gallium/tests/python/tests/regress/vertex-shader/vert-srcmod-neg.sh)0
-rw-r--r--src/gallium/tests/graw/vertex-shader/vert-srcmod-swz.sh (renamed from src/gallium/tests/python/tests/regress/vertex-shader/vert-srcmod-swz.sh)0
-rw-r--r--src/gallium/tests/graw/vertex-shader/vert-sub.sh (renamed from src/gallium/tests/python/tests/regress/vertex-shader/vert-sub.sh)0
-rw-r--r--src/gallium/tests/graw/vertex-shader/vert-xpd.sh (renamed from src/gallium/tests/python/tests/regress/vertex-shader/vert-xpd.sh)0
-rwxr-xr-xsrc/gallium/tests/python/retrace/interpreter.py733
-rwxr-xr-xsrc/gallium/tests/python/tests/surface_copy.py201
-rwxr-xr-xsrc/gallium/tests/python/tests/texture_blit.py638
-rwxr-xr-xsrc/gallium/tests/python/tests/texture_transfer.py182
-rw-r--r--src/gallium/tests/unit/SConscript8
-rw-r--r--src/gallium/tests/unit/translate_test.c22
70 files changed, 317 insertions, 1768 deletions
diff --git a/src/gallium/tests/graw/fragment-shader b/src/gallium/tests/graw/fragment-shader
deleted file mode 120000
index c7dd0b7c6b2..00000000000
--- a/src/gallium/tests/graw/fragment-shader
+++ /dev/null
@@ -1 +0,0 @@
-../python/tests/regress/fragment-shader \ No newline at end of file
diff --git a/src/gallium/tests/graw/fragment-shader/frag-abs.sh b/src/gallium/tests/graw/fragment-shader/frag-abs.sh
new file mode 100644
index 00000000000..103d7497f48
--- /dev/null
+++ b/src/gallium/tests/graw/fragment-shader/frag-abs.sh
@@ -0,0 +1,13 @@
+FRAG
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DCL TEMP[0]
+
+IMM FLT32 { -0.5, -0.4, -0.6, 0.0 }
+
+ADD TEMP[0], IN[0], IMM[0]
+ABS OUT[0], TEMP[0]
+
+END
diff --git a/src/gallium/tests/graw/fragment-shader/frag-add.sh b/src/gallium/tests/graw/fragment-shader/frag-add.sh
new file mode 100644
index 00000000000..bcb94205963
--- /dev/null
+++ b/src/gallium/tests/graw/fragment-shader/frag-add.sh
@@ -0,0 +1,8 @@
+FRAG
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+ADD OUT[0], IN[0], IN[0]
+
+END
diff --git a/src/gallium/tests/graw/fragment-shader/frag-cb-1d.sh b/src/gallium/tests/graw/fragment-shader/frag-cb-1d.sh
new file mode 100644
index 00000000000..85fb9ea4e7f
--- /dev/null
+++ b/src/gallium/tests/graw/fragment-shader/frag-cb-1d.sh
@@ -0,0 +1,13 @@
+FRAG
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+DCL CONST[1]
+DCL CONST[3]
+DCL TEMP[0..1]
+
+ADD TEMP[0], IN[0], CONST[1]
+RCP TEMP[1], CONST[3].xxxx
+MUL OUT[0], TEMP[0], TEMP[1]
+
+END
diff --git a/src/gallium/tests/python/tests/regress/fragment-shader/frag-cb-2d.sh b/src/gallium/tests/graw/fragment-shader/frag-cb-2d.sh
index bbc3a10f9b5..bbc3a10f9b5 100644
--- a/src/gallium/tests/python/tests/regress/fragment-shader/frag-cb-2d.sh
+++ b/src/gallium/tests/graw/fragment-shader/frag-cb-2d.sh
diff --git a/src/gallium/tests/graw/fragment-shader/frag-dp3.sh b/src/gallium/tests/graw/fragment-shader/frag-dp3.sh
new file mode 100644
index 00000000000..b5281975d4a
--- /dev/null
+++ b/src/gallium/tests/graw/fragment-shader/frag-dp3.sh
@@ -0,0 +1,8 @@
+FRAG
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DP3 OUT[0], IN[0], IN[0]
+
+END
diff --git a/src/gallium/tests/graw/fragment-shader/frag-dp4.sh b/src/gallium/tests/graw/fragment-shader/frag-dp4.sh
new file mode 100644
index 00000000000..d59df76e70b
--- /dev/null
+++ b/src/gallium/tests/graw/fragment-shader/frag-dp4.sh
@@ -0,0 +1,8 @@
+FRAG
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DP4 OUT[0], IN[0].xyzx, IN[0].xyzx
+
+END
diff --git a/src/gallium/tests/graw/fragment-shader/frag-dst.sh b/src/gallium/tests/graw/fragment-shader/frag-dst.sh
new file mode 100644
index 00000000000..fbb20fa9f62
--- /dev/null
+++ b/src/gallium/tests/graw/fragment-shader/frag-dst.sh
@@ -0,0 +1,8 @@
+FRAG
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DST OUT[0], IN[0], IN[0]
+
+END
diff --git a/src/gallium/tests/graw/fragment-shader/frag-ex2.sh b/src/gallium/tests/graw/fragment-shader/frag-ex2.sh
new file mode 100644
index 00000000000..b511288f4b6
--- /dev/null
+++ b/src/gallium/tests/graw/fragment-shader/frag-ex2.sh
@@ -0,0 +1,11 @@
+FRAG
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DCL TEMP[0]
+
+EX2 TEMP[0], IN[0].xxxx
+MUL OUT[0], TEMP[0], IN[0]
+
+END
diff --git a/src/gallium/tests/python/tests/regress/fragment-shader/frag-face.sh b/src/gallium/tests/graw/fragment-shader/frag-face.sh
index 5745b6a5aba..5745b6a5aba 100644
--- a/src/gallium/tests/python/tests/regress/fragment-shader/frag-face.sh
+++ b/src/gallium/tests/graw/fragment-shader/frag-face.sh
diff --git a/src/gallium/tests/graw/fragment-shader/frag-flr.sh b/src/gallium/tests/graw/fragment-shader/frag-flr.sh
new file mode 100644
index 00000000000..99a2f96103a
--- /dev/null
+++ b/src/gallium/tests/graw/fragment-shader/frag-flr.sh
@@ -0,0 +1,15 @@
+FRAG
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DCL TEMP[0]
+
+IMM FLT32 { 2.5, 4.0, 2.0, 1.0 }
+IMM FLT32 { 0.4, 0.25, 0.5, 1.0 }
+
+MUL TEMP[0], IN[0], IMM[0]
+FLR TEMP[0], TEMP[0]
+MUL OUT[0], TEMP[0], IMM[1]
+
+END
diff --git a/src/gallium/tests/graw/fragment-shader/frag-frc.sh b/src/gallium/tests/graw/fragment-shader/frag-frc.sh
new file mode 100644
index 00000000000..a54c2623b0a
--- /dev/null
+++ b/src/gallium/tests/graw/fragment-shader/frag-frc.sh
@@ -0,0 +1,13 @@
+FRAG
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DCL TEMP[0]
+
+IMM FLT32 { 2.7, 3.1, 4.5, 1.0 }
+
+MUL TEMP[0], IN[0], IMM[0]
+FRC OUT[0], TEMP[0]
+
+END
diff --git a/src/gallium/tests/python/tests/regress/fragment-shader/frag-kil.sh b/src/gallium/tests/graw/fragment-shader/frag-kil.sh
index 583b0ca4a4a..583b0ca4a4a 100644
--- a/src/gallium/tests/python/tests/regress/fragment-shader/frag-kil.sh
+++ b/src/gallium/tests/graw/fragment-shader/frag-kil.sh
diff --git a/src/gallium/tests/graw/fragment-shader/frag-lg2.sh b/src/gallium/tests/graw/fragment-shader/frag-lg2.sh
new file mode 100644
index 00000000000..5f5b4be1092
--- /dev/null
+++ b/src/gallium/tests/graw/fragment-shader/frag-lg2.sh
@@ -0,0 +1,15 @@
+FRAG
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DCL TEMP[0]
+
+IMM FLT32 { 1.0, 0.0, 0.0, 0.0 }
+IMM FLT32 { 0.5, 0.0, 0.0, 0.0 }
+
+ADD TEMP[0], IN[0], IMM[0]
+LG2 TEMP[0].x, TEMP[0].xxxx
+ADD OUT[0], TEMP[0], IMM[1]
+
+END
diff --git a/src/gallium/tests/graw/fragment-shader/frag-lit.sh b/src/gallium/tests/graw/fragment-shader/frag-lit.sh
new file mode 100644
index 00000000000..6323c4712dc
--- /dev/null
+++ b/src/gallium/tests/graw/fragment-shader/frag-lit.sh
@@ -0,0 +1,8 @@
+FRAG
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+LIT OUT[0], IN[0]
+
+END
diff --git a/src/gallium/tests/graw/fragment-shader/frag-lrp.sh b/src/gallium/tests/graw/fragment-shader/frag-lrp.sh
new file mode 100644
index 00000000000..740809d22e0
--- /dev/null
+++ b/src/gallium/tests/graw/fragment-shader/frag-lrp.sh
@@ -0,0 +1,11 @@
+FRAG
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DCL TEMP[0]
+
+ABS TEMP[0], IN[0]
+LRP OUT[0], TEMP[0], IN[0].xxxx, IN[0].yyyy
+
+END
diff --git a/src/gallium/tests/python/tests/regress/fragment-shader/frag-mad-immx.sh b/src/gallium/tests/graw/fragment-shader/frag-mad-immx.sh
index 6b034915769..6b034915769 100644
--- a/src/gallium/tests/python/tests/regress/fragment-shader/frag-mad-immx.sh
+++ b/src/gallium/tests/graw/fragment-shader/frag-mad-immx.sh
diff --git a/src/gallium/tests/graw/fragment-shader/frag-mad.sh b/src/gallium/tests/graw/fragment-shader/frag-mad.sh
new file mode 100644
index 00000000000..413b9dc3916
--- /dev/null
+++ b/src/gallium/tests/graw/fragment-shader/frag-mad.sh
@@ -0,0 +1,11 @@
+FRAG
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+IMM FLT32 { 0.5, 0.4, 0.6, 1.0 }
+IMM FLT32 { 0.5, 0.4, 0.6, 0.0 }
+
+MAD OUT[0], IN[0], IMM[0], IMM[1]
+
+END
diff --git a/src/gallium/tests/graw/fragment-shader/frag-max.sh b/src/gallium/tests/graw/fragment-shader/frag-max.sh
new file mode 100644
index 00000000000..b69f2132612
--- /dev/null
+++ b/src/gallium/tests/graw/fragment-shader/frag-max.sh
@@ -0,0 +1,10 @@
+FRAG
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+IMM FLT32 { 0.4, 0.4, 0.4, 0.0 }
+
+MAX OUT[0], IN[0], IMM[0]
+
+END
diff --git a/src/gallium/tests/graw/fragment-shader/frag-min.sh b/src/gallium/tests/graw/fragment-shader/frag-min.sh
new file mode 100644
index 00000000000..df284f49e71
--- /dev/null
+++ b/src/gallium/tests/graw/fragment-shader/frag-min.sh
@@ -0,0 +1,10 @@
+FRAG
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+IMM FLT32 { 0.6, 0.6, 0.6, 1.0 }
+
+MIN OUT[0], IN[0], IMM[0]
+
+END
diff --git a/src/gallium/tests/graw/fragment-shader/frag-mov.sh b/src/gallium/tests/graw/fragment-shader/frag-mov.sh
new file mode 100644
index 00000000000..64af72f381b
--- /dev/null
+++ b/src/gallium/tests/graw/fragment-shader/frag-mov.sh
@@ -0,0 +1,8 @@
+FRAG
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+MOV OUT[0], IN[0]
+
+END
diff --git a/src/gallium/tests/graw/fragment-shader/frag-mul.sh b/src/gallium/tests/graw/fragment-shader/frag-mul.sh
new file mode 100644
index 00000000000..bdd0b0026b9
--- /dev/null
+++ b/src/gallium/tests/graw/fragment-shader/frag-mul.sh
@@ -0,0 +1,10 @@
+FRAG
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+IMM FLT32 { 0.5, 0.6, 0.7, 1.0 }
+
+MUL OUT[0], IN[0], IMM[0]
+
+END
diff --git a/src/gallium/tests/graw/fragment-shader/frag-rcp.sh b/src/gallium/tests/graw/fragment-shader/frag-rcp.sh
new file mode 100644
index 00000000000..f4b611b26ab
--- /dev/null
+++ b/src/gallium/tests/graw/fragment-shader/frag-rcp.sh
@@ -0,0 +1,15 @@
+FRAG
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DCL TEMP[0]
+
+IMM FLT32 { 1.0, 0.0, 0.0, 0.0 }
+IMM FLT32 { 1.5, 0.0, 0.0, 0.0 }
+
+ADD TEMP[0], IN[0], IMM[0]
+RCP TEMP[0].x, TEMP[0].xxxx
+SUB OUT[0], TEMP[0], IMM[1]
+
+END
diff --git a/src/gallium/tests/graw/fragment-shader/frag-rsq.sh b/src/gallium/tests/graw/fragment-shader/frag-rsq.sh
new file mode 100644
index 00000000000..d1e9b0b53be
--- /dev/null
+++ b/src/gallium/tests/graw/fragment-shader/frag-rsq.sh
@@ -0,0 +1,15 @@
+FRAG
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DCL TEMP[0]
+
+IMM FLT32 { 1.0, 0.0, 0.0, 0.0 }
+IMM FLT32 { 1.5, 0.0, 0.0, 0.0 }
+
+ADD TEMP[0], IN[0], IMM[0]
+RSQ TEMP[0].x, TEMP[0].xxxx
+SUB OUT[0], TEMP[0], IMM[1]
+
+END
diff --git a/src/gallium/tests/graw/fragment-shader/frag-sge.sh b/src/gallium/tests/graw/fragment-shader/frag-sge.sh
new file mode 100644
index 00000000000..1f33fac4727
--- /dev/null
+++ b/src/gallium/tests/graw/fragment-shader/frag-sge.sh
@@ -0,0 +1,13 @@
+FRAG
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DCL TEMP[0]
+
+IMM FLT32 { 0.6, 0.6, 0.6, 0.0 }
+
+SGE TEMP[0], IN[0], IMM[0]
+MUL OUT[0], IN[0], TEMP[0]
+
+END
diff --git a/src/gallium/tests/graw/fragment-shader/frag-slt.sh b/src/gallium/tests/graw/fragment-shader/frag-slt.sh
new file mode 100644
index 00000000000..d58b7886a12
--- /dev/null
+++ b/src/gallium/tests/graw/fragment-shader/frag-slt.sh
@@ -0,0 +1,13 @@
+FRAG
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DCL TEMP[0]
+
+IMM FLT32 { 0.6, 0.6, 0.6, 0.0 }
+
+SLT TEMP[0], IN[0], IMM[0]
+MUL OUT[0], IN[0], TEMP[0]
+
+END
diff --git a/src/gallium/tests/graw/fragment-shader/frag-srcmod-abs.sh b/src/gallium/tests/graw/fragment-shader/frag-srcmod-abs.sh
new file mode 100644
index 00000000000..ecd19248c64
--- /dev/null
+++ b/src/gallium/tests/graw/fragment-shader/frag-srcmod-abs.sh
@@ -0,0 +1,13 @@
+FRAG
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DCL TEMP[0]
+
+IMM FLT32 { -0.3, -0.5, -0.4, 0.0 }
+
+ADD TEMP[0], IN[0], IMM[0]
+MOV OUT[0], |TEMP[0]|
+
+END
diff --git a/src/gallium/tests/graw/fragment-shader/frag-srcmod-absneg.sh b/src/gallium/tests/graw/fragment-shader/frag-srcmod-absneg.sh
new file mode 100644
index 00000000000..c2d99ddd15b
--- /dev/null
+++ b/src/gallium/tests/graw/fragment-shader/frag-srcmod-absneg.sh
@@ -0,0 +1,15 @@
+FRAG
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DCL TEMP[0]
+
+IMM FLT32 { -0.2, -0.3, -0.4, 0.0 }
+IMM FLT32 { -1.0, -1.0, -1.0, -1.0 }
+
+ADD TEMP[0], IN[0], IMM[0]
+MOV TEMP[0], -|TEMP[0]|
+MUL OUT[0], TEMP[0], IMM[1]
+
+END
diff --git a/src/gallium/tests/graw/fragment-shader/frag-srcmod-neg.sh b/src/gallium/tests/graw/fragment-shader/frag-srcmod-neg.sh
new file mode 100644
index 00000000000..a08ab6d2dcb
--- /dev/null
+++ b/src/gallium/tests/graw/fragment-shader/frag-srcmod-neg.sh
@@ -0,0 +1,11 @@
+FRAG
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DCL TEMP[0]
+
+SUB TEMP[0], IN[0], IN[0].yzxw
+MOV OUT[0], -TEMP[0]
+
+END
diff --git a/src/gallium/tests/graw/fragment-shader/frag-srcmod-swz.sh b/src/gallium/tests/graw/fragment-shader/frag-srcmod-swz.sh
new file mode 100644
index 00000000000..6110647d979
--- /dev/null
+++ b/src/gallium/tests/graw/fragment-shader/frag-srcmod-swz.sh
@@ -0,0 +1,8 @@
+FRAG
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+MOV OUT[0], IN[0].yxzw
+
+END
diff --git a/src/gallium/tests/graw/fragment-shader/frag-sub.sh b/src/gallium/tests/graw/fragment-shader/frag-sub.sh
new file mode 100644
index 00000000000..673fca139aa
--- /dev/null
+++ b/src/gallium/tests/graw/fragment-shader/frag-sub.sh
@@ -0,0 +1,8 @@
+FRAG
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+SUB OUT[0], IN[0], IN[0].yzxw
+
+END
diff --git a/src/gallium/tests/python/tests/regress/fragment-shader/frag-tempx.sh b/src/gallium/tests/graw/fragment-shader/frag-tempx.sh
index 81bcad2d65c..81bcad2d65c 100644
--- a/src/gallium/tests/python/tests/regress/fragment-shader/frag-tempx.sh
+++ b/src/gallium/tests/graw/fragment-shader/frag-tempx.sh
diff --git a/src/gallium/tests/graw/fragment-shader/frag-xpd.sh b/src/gallium/tests/graw/fragment-shader/frag-xpd.sh
new file mode 100644
index 00000000000..6ec8b1184cc
--- /dev/null
+++ b/src/gallium/tests/graw/fragment-shader/frag-xpd.sh
@@ -0,0 +1,8 @@
+FRAG
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+XPD OUT[0], IN[0], IN[0].yzxw
+
+END
diff --git a/src/gallium/tests/graw/vertex-shader b/src/gallium/tests/graw/vertex-shader
deleted file mode 120000
index 7b216e8ca08..00000000000
--- a/src/gallium/tests/graw/vertex-shader
+++ /dev/null
@@ -1 +0,0 @@
-../python/tests/regress/vertex-shader \ No newline at end of file
diff --git a/src/gallium/tests/python/tests/regress/vertex-shader/vert-abs.sh b/src/gallium/tests/graw/vertex-shader/vert-abs.sh
index 062a48b531e..062a48b531e 100644
--- a/src/gallium/tests/python/tests/regress/vertex-shader/vert-abs.sh
+++ b/src/gallium/tests/graw/vertex-shader/vert-abs.sh
diff --git a/src/gallium/tests/python/tests/regress/vertex-shader/vert-add.sh b/src/gallium/tests/graw/vertex-shader/vert-add.sh
index 188931ebc8d..188931ebc8d 100644
--- a/src/gallium/tests/python/tests/regress/vertex-shader/vert-add.sh
+++ b/src/gallium/tests/graw/vertex-shader/vert-add.sh
diff --git a/src/gallium/tests/python/tests/regress/vertex-shader/vert-arl.sh b/src/gallium/tests/graw/vertex-shader/vert-arl.sh
index 0039597f6f0..0039597f6f0 100644
--- a/src/gallium/tests/python/tests/regress/vertex-shader/vert-arl.sh
+++ b/src/gallium/tests/graw/vertex-shader/vert-arl.sh
diff --git a/src/gallium/tests/python/tests/regress/vertex-shader/vert-arr.sh b/src/gallium/tests/graw/vertex-shader/vert-arr.sh
index fdde4f9ad12..fdde4f9ad12 100644
--- a/src/gallium/tests/python/tests/regress/vertex-shader/vert-arr.sh
+++ b/src/gallium/tests/graw/vertex-shader/vert-arr.sh
diff --git a/src/gallium/tests/python/tests/regress/vertex-shader/vert-cb-1d.sh b/src/gallium/tests/graw/vertex-shader/vert-cb-1d.sh
index e227917fd3b..e227917fd3b 100644
--- a/src/gallium/tests/python/tests/regress/vertex-shader/vert-cb-1d.sh
+++ b/src/gallium/tests/graw/vertex-shader/vert-cb-1d.sh
diff --git a/src/gallium/tests/python/tests/regress/vertex-shader/vert-cb-2d.sh b/src/gallium/tests/graw/vertex-shader/vert-cb-2d.sh
index 39768d2dda9..39768d2dda9 100644
--- a/src/gallium/tests/python/tests/regress/vertex-shader/vert-cb-2d.sh
+++ b/src/gallium/tests/graw/vertex-shader/vert-cb-2d.sh
diff --git a/src/gallium/tests/python/tests/regress/vertex-shader/vert-dp3.sh b/src/gallium/tests/graw/vertex-shader/vert-dp3.sh
index 357e224f696..357e224f696 100644
--- a/src/gallium/tests/python/tests/regress/vertex-shader/vert-dp3.sh
+++ b/src/gallium/tests/graw/vertex-shader/vert-dp3.sh
diff --git a/src/gallium/tests/python/tests/regress/vertex-shader/vert-dp4.sh b/src/gallium/tests/graw/vertex-shader/vert-dp4.sh
index 14f61066014..14f61066014 100644
--- a/src/gallium/tests/python/tests/regress/vertex-shader/vert-dp4.sh
+++ b/src/gallium/tests/graw/vertex-shader/vert-dp4.sh
diff --git a/src/gallium/tests/python/tests/regress/vertex-shader/vert-dst.sh b/src/gallium/tests/graw/vertex-shader/vert-dst.sh
index 2d59bd1a0c3..2d59bd1a0c3 100644
--- a/src/gallium/tests/python/tests/regress/vertex-shader/vert-dst.sh
+++ b/src/gallium/tests/graw/vertex-shader/vert-dst.sh
diff --git a/src/gallium/tests/python/tests/regress/vertex-shader/vert-ex2.sh b/src/gallium/tests/graw/vertex-shader/vert-ex2.sh
index e2383a6b5bd..e2383a6b5bd 100644
--- a/src/gallium/tests/python/tests/regress/vertex-shader/vert-ex2.sh
+++ b/src/gallium/tests/graw/vertex-shader/vert-ex2.sh
diff --git a/src/gallium/tests/python/tests/regress/vertex-shader/vert-flr.sh b/src/gallium/tests/graw/vertex-shader/vert-flr.sh
index fa24806663b..fa24806663b 100644
--- a/src/gallium/tests/python/tests/regress/vertex-shader/vert-flr.sh
+++ b/src/gallium/tests/graw/vertex-shader/vert-flr.sh
diff --git a/src/gallium/tests/python/tests/regress/vertex-shader/vert-frc.sh b/src/gallium/tests/graw/vertex-shader/vert-frc.sh
index ff09bfafd0c..ff09bfafd0c 100644
--- a/src/gallium/tests/python/tests/regress/vertex-shader/vert-frc.sh
+++ b/src/gallium/tests/graw/vertex-shader/vert-frc.sh
diff --git a/src/gallium/tests/python/tests/regress/vertex-shader/vert-lg2.sh b/src/gallium/tests/graw/vertex-shader/vert-lg2.sh
index 876b7ab6608..876b7ab6608 100644
--- a/src/gallium/tests/python/tests/regress/vertex-shader/vert-lg2.sh
+++ b/src/gallium/tests/graw/vertex-shader/vert-lg2.sh
diff --git a/src/gallium/tests/python/tests/regress/vertex-shader/vert-lit.sh b/src/gallium/tests/graw/vertex-shader/vert-lit.sh
index a2235ff6119..a2235ff6119 100644
--- a/src/gallium/tests/python/tests/regress/vertex-shader/vert-lit.sh
+++ b/src/gallium/tests/graw/vertex-shader/vert-lit.sh
diff --git a/src/gallium/tests/python/tests/regress/vertex-shader/vert-lrp.sh b/src/gallium/tests/graw/vertex-shader/vert-lrp.sh
index a26ca3b0ec0..a26ca3b0ec0 100644
--- a/src/gallium/tests/python/tests/regress/vertex-shader/vert-lrp.sh
+++ b/src/gallium/tests/graw/vertex-shader/vert-lrp.sh
diff --git a/src/gallium/tests/python/tests/regress/vertex-shader/vert-mad.sh b/src/gallium/tests/graw/vertex-shader/vert-mad.sh
index caf83a91e48..caf83a91e48 100644
--- a/src/gallium/tests/python/tests/regress/vertex-shader/vert-mad.sh
+++ b/src/gallium/tests/graw/vertex-shader/vert-mad.sh
diff --git a/src/gallium/tests/python/tests/regress/vertex-shader/vert-max.sh b/src/gallium/tests/graw/vertex-shader/vert-max.sh
index db84a499214..db84a499214 100644
--- a/src/gallium/tests/python/tests/regress/vertex-shader/vert-max.sh
+++ b/src/gallium/tests/graw/vertex-shader/vert-max.sh
diff --git a/src/gallium/tests/python/tests/regress/vertex-shader/vert-min.sh b/src/gallium/tests/graw/vertex-shader/vert-min.sh
index 63a8c2cf3cd..63a8c2cf3cd 100644
--- a/src/gallium/tests/python/tests/regress/vertex-shader/vert-min.sh
+++ b/src/gallium/tests/graw/vertex-shader/vert-min.sh
diff --git a/src/gallium/tests/python/tests/regress/vertex-shader/vert-mov.sh b/src/gallium/tests/graw/vertex-shader/vert-mov.sh
index 4c23e3eaadb..4c23e3eaadb 100644
--- a/src/gallium/tests/python/tests/regress/vertex-shader/vert-mov.sh
+++ b/src/gallium/tests/graw/vertex-shader/vert-mov.sh
diff --git a/src/gallium/tests/python/tests/regress/vertex-shader/vert-mul.sh b/src/gallium/tests/graw/vertex-shader/vert-mul.sh
index a409cd4b21e..a409cd4b21e 100644
--- a/src/gallium/tests/python/tests/regress/vertex-shader/vert-mul.sh
+++ b/src/gallium/tests/graw/vertex-shader/vert-mul.sh
diff --git a/src/gallium/tests/python/tests/regress/vertex-shader/vert-rcp.sh b/src/gallium/tests/graw/vertex-shader/vert-rcp.sh
index d440e35d9a3..d440e35d9a3 100644
--- a/src/gallium/tests/python/tests/regress/vertex-shader/vert-rcp.sh
+++ b/src/gallium/tests/graw/vertex-shader/vert-rcp.sh
diff --git a/src/gallium/tests/python/tests/regress/vertex-shader/vert-rsq.sh b/src/gallium/tests/graw/vertex-shader/vert-rsq.sh
index 6fbd53ae0ac..6fbd53ae0ac 100644
--- a/src/gallium/tests/python/tests/regress/vertex-shader/vert-rsq.sh
+++ b/src/gallium/tests/graw/vertex-shader/vert-rsq.sh
diff --git a/src/gallium/tests/python/tests/regress/vertex-shader/vert-sge.sh b/src/gallium/tests/graw/vertex-shader/vert-sge.sh
index e32a21b6109..e32a21b6109 100644
--- a/src/gallium/tests/python/tests/regress/vertex-shader/vert-sge.sh
+++ b/src/gallium/tests/graw/vertex-shader/vert-sge.sh
diff --git a/src/gallium/tests/python/tests/regress/vertex-shader/vert-slt.sh b/src/gallium/tests/graw/vertex-shader/vert-slt.sh
index 2af61062922..2af61062922 100644
--- a/src/gallium/tests/python/tests/regress/vertex-shader/vert-slt.sh
+++ b/src/gallium/tests/graw/vertex-shader/vert-slt.sh
diff --git a/src/gallium/tests/python/tests/regress/vertex-shader/vert-srcmod-abs.sh b/src/gallium/tests/graw/vertex-shader/vert-srcmod-abs.sh
index e768d95049d..e768d95049d 100644
--- a/src/gallium/tests/python/tests/regress/vertex-shader/vert-srcmod-abs.sh
+++ b/src/gallium/tests/graw/vertex-shader/vert-srcmod-abs.sh
diff --git a/src/gallium/tests/python/tests/regress/vertex-shader/vert-srcmod-absneg.sh b/src/gallium/tests/graw/vertex-shader/vert-srcmod-absneg.sh
index 40ca5d60def..40ca5d60def 100644
--- a/src/gallium/tests/python/tests/regress/vertex-shader/vert-srcmod-absneg.sh
+++ b/src/gallium/tests/graw/vertex-shader/vert-srcmod-absneg.sh
diff --git a/src/gallium/tests/python/tests/regress/vertex-shader/vert-srcmod-neg.sh b/src/gallium/tests/graw/vertex-shader/vert-srcmod-neg.sh
index 297bc1ee3ed..297bc1ee3ed 100644
--- a/src/gallium/tests/python/tests/regress/vertex-shader/vert-srcmod-neg.sh
+++ b/src/gallium/tests/graw/vertex-shader/vert-srcmod-neg.sh
diff --git a/src/gallium/tests/python/tests/regress/vertex-shader/vert-srcmod-swz.sh b/src/gallium/tests/graw/vertex-shader/vert-srcmod-swz.sh
index 528f164b9ee..528f164b9ee 100644
--- a/src/gallium/tests/python/tests/regress/vertex-shader/vert-srcmod-swz.sh
+++ b/src/gallium/tests/graw/vertex-shader/vert-srcmod-swz.sh
diff --git a/src/gallium/tests/python/tests/regress/vertex-shader/vert-sub.sh b/src/gallium/tests/graw/vertex-shader/vert-sub.sh
index 90249abdd38..90249abdd38 100644
--- a/src/gallium/tests/python/tests/regress/vertex-shader/vert-sub.sh
+++ b/src/gallium/tests/graw/vertex-shader/vert-sub.sh
diff --git a/src/gallium/tests/python/tests/regress/vertex-shader/vert-xpd.sh b/src/gallium/tests/graw/vertex-shader/vert-xpd.sh
index 72b048676fb..72b048676fb 100644
--- a/src/gallium/tests/python/tests/regress/vertex-shader/vert-xpd.sh
+++ b/src/gallium/tests/graw/vertex-shader/vert-xpd.sh
diff --git a/src/gallium/tests/python/retrace/interpreter.py b/src/gallium/tests/python/retrace/interpreter.py
deleted file mode 100755
index 84371223f66..00000000000
--- a/src/gallium/tests/python/retrace/interpreter.py
+++ /dev/null
@@ -1,733 +0,0 @@
-#!/usr/bin/env python
-##########################################################################
-#
-# Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
-# All Rights Reserved.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sub license, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice (including the
-# next paragraph) shall be included in all copies or substantial portions
-# of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-# IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
-# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-##########################################################################
-
-
-import sys
-import struct
-
-import gallium
-import model
-import parse as parser
-
-
-try:
- from struct import unpack_from
-except ImportError:
- def unpack_from(fmt, buf, offset=0):
- size = struct.calcsize(fmt)
- return struct.unpack(fmt, buf[offset:offset + size])
-
-
-def make_image(ctx, surface, x=None, y=None, w=None, h=None):
- if x is None:
- x = 0
- if y is None:
- y = 0
- if w is None:
- w = surface.width - x
- if h is None:
- h = surface.height - y
- data = ctx.surface_read_rgba8(surface, x, y, surface.width, surface.height)
-
- import Image
- outimage = Image.fromstring('RGBA', (w, h), data, "raw", 'RGBA', 0, 1)
- return outimage
-
-def save_image(ctx, filename, surface, x=None, y=None, w=None, h=None):
- outimage = make_image(ctx, surface, x, y, w, h)
- outimage.save(filename, "PNG")
-
-def show_image(ctx, surface, title, x=None, y=None, w=None, h=None):
- outimage = make_image(ctx, surface, x, y, w, h)
-
- import Tkinter as tk
- from PIL import Image, ImageTk
- root = tk.Tk()
-
- root.title(title)
-
- image1 = ImageTk.PhotoImage(outimage)
- w = image1.width()
- h = image1.height()
- x = 100
- y = 100
- root.geometry("%dx%d+%d+%d" % (w, h, x, y))
- panel1 = tk.Label(root, image=image1)
- panel1.pack(side='top', fill='both', expand='yes')
- panel1.image = image1
- root.mainloop()
-
-
-class Struct:
- """C-like struct"""
-
- # A basic Python class can pass as a C-like structure
- pass
-
-
-struct_factories = {
- "pipe_blend_color": gallium.BlendColor,
- "pipe_blend_state": gallium.Blend,
- #"pipe_clip_state": gallium.Clip,
- #"pipe_buffer": gallium.Buffer,
- "pipe_depth_state": gallium.Depth,
- "pipe_stencil_state": gallium.Stencil,
- "pipe_alpha_state": gallium.Alpha,
- "pipe_depth_stencil_alpha_state": gallium.DepthStencilAlpha,
- #"pipe_framebuffer_state": gallium.Framebuffer,
- "pipe_poly_stipple": gallium.PolyStipple,
- "pipe_rasterizer_state": gallium.Rasterizer,
- "pipe_sampler_state": gallium.Sampler,
- "pipe_scissor_state": gallium.Scissor,
- #"pipe_shader_state": gallium.Shader,
- #"pipe_vertex_buffer": gallium.VertexBuffer,
- "pipe_vertex_element": gallium.VertexElement,
- "pipe_viewport_state": gallium.Viewport,
- #"pipe_texture": gallium.Texture,
- 'pipe_subresource': gallium.pipe_subresource,
- 'pipe_box': gallium.pipe_box,
- 'pipe_draw_info': gallium.pipe_draw_info,
-}
-
-
-member_array_factories = {
- #"pipe_rasterizer_state": {"sprite_coord_mode": gallium.ByteArray},
- "pipe_poly_stipple": {"stipple": gallium.UnsignedArray},
- "pipe_viewport_state": {"scale": gallium.FloatArray, "translate": gallium.FloatArray},
- #"pipe_clip_state": {"ucp": gallium.FloatArray},
- "pipe_depth_stencil_alpha_state": {"stencil": gallium.StencilArray},
- "pipe_blend_color": {"color": gallium.FloatArray},
- "pipe_sampler_state": {"border_color": gallium.FloatArray},
-}
-
-
-class Translator(model.Visitor):
- """Translate model arguments into regular Python objects"""
-
- def __init__(self, interpreter):
- self.interpreter = interpreter
- self.result = None
-
- def visit(self, node):
- self.result = None
- node.visit(self)
- return self.result
-
- def visit_literal(self, node):
- self.result = node.value
-
- def visit_named_constant(self, node):
- # lookup the named constant in the gallium module
- self.result = getattr(gallium, node.name)
-
- def visit_array(self, node):
- array = []
- for element in node.elements:
- array.append(self.visit(element))
- self.result = array
-
- def visit_struct(self, node):
- struct_factory = struct_factories.get(node.name, Struct)
- struct = struct_factory()
- for member_name, member_node in node.members:
- member_value = self.visit(member_node)
- try:
- array_factory = member_array_factories[node.name][member_name]
- except KeyError:
- pass
- else:
- assert isinstance(member_value, list)
- array = array_factory(len(member_value))
- for i in range(len(member_value)):
- array[i] = member_value[i]
- member_value = array
- #print node.name, member_name, member_value
- assert isinstance(struct, Struct) or hasattr(struct, member_name)
- setattr(struct, member_name, member_value)
- self.result = struct
-
- def visit_pointer(self, node):
- self.result = self.interpreter.lookup_object(node.address)
-
-
-class Object:
-
- def __init__(self, interpreter, real):
- self.interpreter = interpreter
- self.real = real
-
-
-class Global(Object):
-
- def __init__(self, interpreter, real):
- self.interpreter = interpreter
- self.real = real
-
- def pipe_screen_create(self):
- real = gallium.Device()
- return Screen(self.interpreter, real)
-
- def pipe_context_create(self, screen):
- context = screen.real.context_create()
- return Context(self.interpreter, context)
-
-
-class Transfer:
-
- def __init__(self, resource, usage, subresource, box):
- self.resource = resource
- self.usage = usage
- self.subresource = subresource
- self.box = box
-
-
-class Screen(Object):
-
- def __init__(self, interpreter, real):
- Object.__init__(self, interpreter, real)
- self.context = self.real.context_create()
-
- def destroy(self):
- pass
-
- def get_name(self):
- pass
-
- def get_vendor(self):
- pass
-
- def get_param(self, param):
- pass
-
- def get_paramf(self, param):
- pass
-
- def context_create(self):
- context = self.real.context_create()
- return Context(self.interpreter, context)
-
- def is_format_supported(self, format, target, sample_count, bind, geom_flags):
- return self.real.is_format_supported(format, target, sample_count, bind, geom_flags)
-
- def resource_create(self, templat):
- return self.real.resource_create(
- format = templat.format,
- width = templat.width,
- height = templat.height,
- depth = templat.depth,
- last_level = templat.last_level,
- target = templat.target,
- bind = templat.bind,
- )
-
- def texture_destroy(self, texture):
- self.interpreter.unregister_object(texture)
-
- def texture_release(self, surface):
- pass
-
- def tex_surface_release(self, surface):
- pass
-
- def user_buffer_create(self, data, size, usage):
- bind = usage
- # We don't really care to distinguish between user and regular buffers
- buffer = self.real.buffer_create(size, bind)
- assert size == len(data)
- self.context.buffer_write(buffer, data)
- return buffer
-
- def buffer_create(self, alignment, usage, size):
- return self.real.buffer_create(size, alignment, usage)
-
- def buffer_destroy(self, buffer):
- pass
-
- def fence_finish(self, fence, flags):
- pass
-
- def fence_reference(self, dst, src):
- pass
-
- def flush_frontbuffer(self, resource):
- pass
-
-
-class Context(Object):
-
- def __init__(self, interpreter, real):
- Object.__init__(self, interpreter, real)
- self.cbufs = []
- self.zsbuf = None
- self.vbufs = []
- self.velems = []
- self.dirty = False
-
- def destroy(self):
- pass
-
- def create_blend_state(self, state):
- if isinstance(state, str):
- state = gallium.Blend(state)
- sys.stdout.write('\t%s\n' % state)
- return state
-
- def bind_blend_state(self, state):
- if state is not None:
- self.real.set_blend(state)
-
- def delete_blend_state(self, state):
- pass
-
- def create_sampler_state(self, state):
- return state
-
- def delete_sampler_state(self, state):
- pass
-
- def bind_vertex_sampler_states(self, num_states, states):
- for i in range(num_states):
- self.real.set_vertex_sampler(i, states[i])
-
- def bind_fragment_sampler_states(self, num_states, states):
- for i in range(num_states):
- self.real.set_fragment_sampler(i, states[i])
-
- def create_rasterizer_state(self, state):
- return state
-
- def bind_rasterizer_state(self, state):
- if state is not None:
- self.real.set_rasterizer(state)
-
- def delete_rasterizer_state(self, state):
- pass
-
- def create_depth_stencil_alpha_state(self, state):
- return state
-
- def bind_depth_stencil_alpha_state(self, state):
- if state is not None:
- self.real.set_depth_stencil_alpha(state)
-
- def delete_depth_stencil_alpha_state(self, state):
- pass
-
- def create_fs_state(self, state):
- tokens = str(state.tokens)
- shader = gallium.Shader(tokens)
- return shader
-
- create_vs_state = create_fs_state
-
- def bind_fs_state(self, state):
- self.real.set_fragment_shader(state)
-
- def bind_vs_state(self, state):
- self.real.set_vertex_shader(state)
-
- def delete_fs_state(self, state):
- pass
-
- delete_vs_state = delete_fs_state
-
- def set_blend_color(self, state):
- self.real.set_blend_color(state)
-
- def set_stencil_ref(self, state):
- self.real.set_stencil_ref(state)
-
- def set_clip_state(self, state):
- _state = gallium.Clip()
- _state.nr = state.nr
- if state.nr:
- # FIXME
- ucp = gallium.FloatArray(gallium.PIPE_MAX_CLIP_PLANES*4)
- for i in range(len(state.ucp)):
- for j in range(len(state.ucp[i])):
- ucp[i*4 + j] = state.ucp[i][j]
- _state.ucp = ucp
- self.real.set_clip(_state)
-
- def dump_constant_buffer(self, buffer):
- if not self.interpreter.verbosity(2):
- return
-
- data = self.real.buffer_read(buffer)
- format = '4f'
- index = 0
- for offset in range(0, len(data), struct.calcsize(format)):
- x, y, z, w = unpack_from(format, data, offset)
- sys.stdout.write('\tCONST[%2u] = {%10.4f, %10.4f, %10.4f, %10.4f}\n' % (index, x, y, z, w))
- index += 1
- sys.stdout.flush()
-
- def set_constant_buffer(self, shader, index, buffer):
- if buffer is not None:
- self.real.set_constant_buffer(shader, index, buffer)
-
- self.dump_constant_buffer(buffer)
-
- def set_framebuffer_state(self, state):
- _state = gallium.Framebuffer()
- _state.width = state.width
- _state.height = state.height
- _state.nr_cbufs = state.nr_cbufs
- for i in range(len(state.cbufs)):
- _state.set_cbuf(i, state.cbufs[i])
- _state.set_zsbuf(state.zsbuf)
- self.real.set_framebuffer(_state)
-
- self.cbufs = state.cbufs
- self.zsbuf = state.zsbuf
-
- def set_polygon_stipple(self, state):
- self.real.set_polygon_stipple(state)
-
- def set_scissor_state(self, state):
- self.real.set_scissor(state)
-
- def set_viewport_state(self, state):
- self.real.set_viewport(state)
-
- def create_sampler_view(self, texture, templ):
- return self.real.create_sampler_view(texture,
- format = templ.format,
- first_level = templ.first_level,
- last_level = templ.last_level,
- swizzle_r = templ.swizzle_r,
- swizzle_g = templ.swizzle_r,
- swizzle_b = templ.swizzle_g,
- swizzle_a = templ.swizzle_a)
-
- def sampler_view_destroy(self, view):
- pass
-
- def set_fragment_sampler_views(self, num, views):
- for i in range(num):
- self.real.set_fragment_sampler_view(i, views[i])
-
- def set_vertex_sampler_views(self, num, views):
- for i in range(num):
- self.real.set_vertex_sampler_view(i, views[i])
-
- def set_vertex_buffers(self, num_buffers, buffers):
- self.vbufs = buffers[0:num_buffers]
- for i in range(num_buffers):
- vbuf = buffers[i]
- self.real.set_vertex_buffer(
- i,
- stride = vbuf.stride,
- max_index = vbuf.max_index,
- buffer_offset = vbuf.buffer_offset,
- buffer = vbuf.buffer,
- )
-
- def create_vertex_elements_state(self, num_elements, elements):
- return elements[0:num_elements]
-
- def bind_vertex_elements_state(self, state):
- if state is None:
- self.real.set_vertex_elements(0)
- return
-
- elements = state
- num_elements = len(elements)
- self.velems = elements
- for i in range(num_elements):
- self.real.set_vertex_element(i, elements[i])
- self.real.set_vertex_elements(num_elements)
-
- def delete_vertex_elements_state(self, state):
- pass
-
- def dump_vertices(self, start, count):
- if not self.interpreter.verbosity(2):
- return
-
- for index in range(start, start + count):
- if index >= start + 16:
- sys.stdout.write('\t...\n')
- break
- sys.stdout.write('\t{\n')
- for velem in self.velems:
- vbuf = self.vbufs[velem.vertex_buffer_index]
-
- offset = vbuf.buffer_offset + velem.src_offset + vbuf.stride*index
- format = {
- gallium.PIPE_FORMAT_R32_FLOAT: 'f',
- gallium.PIPE_FORMAT_R32G32_FLOAT: '2f',
- gallium.PIPE_FORMAT_R32G32B32_FLOAT: '3f',
- gallium.PIPE_FORMAT_R32G32B32A32_FLOAT: '4f',
- gallium.PIPE_FORMAT_A8R8G8B8_UNORM: '4B',
- gallium.PIPE_FORMAT_R8G8B8A8_UNORM: '4B',
- gallium.PIPE_FORMAT_B8G8R8A8_UNORM: '4B',
- gallium.PIPE_FORMAT_R16G16B16_SNORM: '3h',
- }[velem.src_format]
-
- data = self.real.buffer_read(vbuf.buffer)
- values = unpack_from(format, data, offset)
- sys.stdout.write('\t\t{' + ', '.join(map(str, values)) + '},\n')
- sys.stdout.write('\t},\n')
- sys.stdout.flush()
-
- def dump_indices(self, ibuf, isize, ibias, start, count):
- if not self.interpreter.verbosity(2):
- return
-
- format = {
- 1: 'B',
- 2: 'H',
- 4: 'I',
- }[isize]
-
- assert struct.calcsize(format) == isize
-
- data = self.real.buffer_read(ibuf)
- maxindex, minindex = 0, 0xffffffff
-
- sys.stdout.write('\t{\n')
- for i in range(start, start + count):
- if i >= start + 16 and not self.interpreter.verbosity(3):
- sys.stdout.write('\t...\n')
- break
- offset = i*isize
- index, = unpack_from(format, data, offset)
- sys.stdout.write('\t\t%u,\n' % index)
- minindex = min(minindex, index)
- maxindex = max(maxindex, index)
- sys.stdout.write('\t},\n')
- sys.stdout.flush()
-
- return minindex + ibias, maxindex + ibias
-
- def set_index_buffer(self, ib):
- if ib:
- self.real.set_index_buffer(ib.index_size, ib.offset, ib.buffer)
- else:
- self.real.set_index_buffer(0, 0, None)
-
- def draw_vbo(self, info):
- if self.interpreter.verbosity(2):
- if 0:
- minindex, maxindex = self.dump_indices(indexBuffer, indexSize, indexBias, start, count)
-
- self.dump_vertices(info.minindex, info.maxindex + 1 - info.minindex)
-
- self.real.draw_vbo(info)
- self._set_dirty()
-
- def resource_copy_region(self, dst, subdst, dstx, dsty, dstz, src, subsrc, srcx, srcy, srcz, width, height):
- if dst is not None and src is not None:
- if self.interpreter.options.all:
- self.interpreter.present(self.real, src, 'resource_copy_src', srcx, srcy, width, height)
- self.real.resource_copy_region(dst, subdst, dstx, dsty, dstx, src, subsrc, srcx, srcy, srcz, width, height)
- flags = 0
- self.flush(flags)
- if self.interpreter.options.all:
- self.interpreter.present(self.real, dst, 'resource_copy_dst', dstx, dsty, width, height)
-
- def is_resource_referenced(self, texture, face, level):
- #return self.real.is_resource_referenced(format, texture, face, level)
- pass
-
- def buffer_write(self, buffer, data, size, offset=0):
- assert size == len(data)
- self.buffer_write(buffer, data)
-
- def surface_write(self, surface, data, stride, size):
- if surface is None:
- return
-# assert surface.nblocksy * stride == size
- surface.put_tile_raw(0, 0, surface.width, surface.height, data, stride)
-
- def get_transfer(self, texture, sr, usage, box):
- if texture is None:
- return None
- transfer = Transfer(texture, sr, usage, box)
- if transfer and usage & gallium.PIPE_TRANSFER_READ:
- if self.interpreter.options.all:
- surface = texture.get_surface(sr.face, sr.level, box.z)
- self.interpreter.present(self.real, transfer.surface, 'transf_read', box.x, box.y, box.width, box.height)
- return transfer
-
- def tex_transfer_destroy(self, transfer):
- self.interpreter.unregister_object(transfer)
-
- def transfer_inline_write(self, resource, sr, usage, box, stride, slice_stride, data):
- self.real.transfer_inline_write(resource, sr, usage, box, data, stride, slice_stride)
- if self.interpreter.options.all:
- for z in range(box.z, box.z + box.depth):
- surface = resource.get_surface(sr.face, sr.level, box.z)
- self.interpreter.present(self.real, surface, 'transf_inline_write%u' % z, box.x, box.y, box.width, box.height)
-
- def _set_dirty(self):
- if self.interpreter.options.step:
- self._present()
- else:
- self.dirty = True
-
- def flush(self, flags):
- self.real.flush(flags)
- if self.dirty:
- if flags & gallium.PIPE_FLUSH_FRAME:
- self._present()
- self.dirty = False
- return None
-
- def clear(self, buffers, rgba, depth, stencil):
- _rgba = gallium.FloatArray(4)
- for i in range(4):
- _rgba[i] = rgba[i]
- self.real.clear(buffers, _rgba, depth, stencil)
-
- def clear_render_target(self, dst, rgba, dstx, dsty, width, height):
- _rgba = gallium.FloatArray(4)
- for i in range(4):
- _rgba[i] = rgba[i]
- self.real.clear_render_target(dst, _rgba, dstx, dsty, width, height)
-
- def clear_depth_stencil(self, dst, clear_flags, depth, stencil, dstx, dsty, width, height):
- self.real.clear_depth_stencil(dst, clear_flags, depth, stencil, dstx, dsty, width, height)
-
- def _present(self):
- self.real.flush()
-
- if self.cbufs and self.cbufs[0]:
- self.interpreter.present(self.real, self.cbufs[0], "cbuf")
- if self.zsbuf:
- if self.interpreter.options.all:
- self.interpreter.present(self.real, self.zsbuf, "zsbuf")
- def create_surface(self, texture, level, layer, usage):
- if texture is None:
- return None
- return texture.get_surface(level, layer)
-
- def surface_destroy(self, surface):
- self.interpreter.unregister_object(surface)
-
-class Interpreter(parser.TraceDumper):
-
- ignore_calls = set((
- ('pipe_screen', 'is_format_supported'),
- ('pipe_screen', 'get_param'),
- ('pipe_screen', 'get_paramf'),
- ))
-
- def __init__(self, stream, options):
- parser.TraceDumper.__init__(self, stream)
- self.options = options
- self.objects = {}
- self.result = None
- self.globl = Global(self, None)
- self.call_no = None
-
- def register_object(self, address, object):
- self.objects[address] = object
-
- def unregister_object(self, object):
- # FIXME:
- pass
-
- def lookup_object(self, address):
- return self.objects[address]
-
- def interpret(self, trace):
- for call in trace.calls:
- self.interpret_call(call)
-
- def handle_call(self, call):
- if self.options.stop and call.no > self.options.stop:
- sys.exit(0)
-
- if (call.klass, call.method) in self.ignore_calls:
- return
-
- self.call_no = call.no
-
- if self.verbosity(1):
- parser.TraceDumper.handle_call(self, call)
- sys.stdout.flush()
-
- args = [(str(name), self.interpret_arg(arg)) for name, arg in call.args]
-
- if call.klass:
- name, obj = args[0]
- args = args[1:]
- else:
- obj = self.globl
-
- method = getattr(obj, call.method)
- ret = method(**dict(args))
-
- if call.ret and isinstance(call.ret, model.Pointer):
- if ret is None:
- sys.stderr.write('warning: NULL returned\n')
- self.register_object(call.ret.address, ret)
-
- self.call_no = None
-
- def interpret_arg(self, node):
- translator = Translator(self)
- return translator.visit(node)
-
- def verbosity(self, level):
- return self.options.verbosity >= level
-
- def present(self, ctx, surface, description, x=None, y=None, w=None, h=None):
- if self.call_no < self.options.start:
- return
-
- if self.options.images:
- filename = '%04u_%s.png' % (self.call_no, description)
- save_image(ctx, filename, surface, x, y, w, h)
- else:
- title = '%u. %s' % (self.call_no, description)
- show_image(ctx, surface, title, x, y, w, h)
-
-
-class Main(parser.Main):
-
- def get_optparser(self):
- optparser = parser.Main.get_optparser(self)
- optparser.add_option("-q", "--quiet", action="store_const", const=0, dest="verbosity", help="no messages")
- optparser.add_option("-v", "--verbose", action="count", dest="verbosity", default=1, help="increase verbosity level")
- optparser.add_option("-i", "--images", action="store_true", dest="images", default=False, help="save images instead of showing them")
- optparser.add_option("-a", "--all", action="store_true", dest="all", default=False, help="show depth, stencil, and transfers")
- optparser.add_option("-s", "--step", action="store_true", dest="step", default=False, help="step trhough every draw")
- optparser.add_option("-f", "--from", action="store", type="int", dest="start", default=0, help="from call no")
- optparser.add_option("-t", "--to", action="store", type="int", dest="stop", default=0, help="until call no")
- return optparser
-
- def process_arg(self, stream, options):
- parser = Interpreter(stream, options)
- parser.parse()
-
-
-if __name__ == '__main__':
- Main().main()
diff --git a/src/gallium/tests/python/tests/surface_copy.py b/src/gallium/tests/python/tests/surface_copy.py
deleted file mode 100755
index 7a6ede38044..00000000000
--- a/src/gallium/tests/python/tests/surface_copy.py
+++ /dev/null
@@ -1,201 +0,0 @@
-#!/usr/bin/env python
-##########################################################################
-#
-# Copyright 2009 VMware, Inc.
-# All Rights Reserved.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sub license, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice (including the
-# next paragraph) shall be included in all copies or substantial portions
-# of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-# IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
-# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-##########################################################################
-
-
-import os
-import random
-
-from gallium import *
-from base import *
-
-
-def lods(*dims):
- size = max(dims)
- lods = 0
- while size:
- lods += 1
- size >>= 1
- return lods
-
-
-class TextureTest(TestCase):
-
- tags = (
- 'target',
- 'format',
- 'width',
- 'height',
- 'depth',
- 'last_level',
- 'face',
- 'level',
- 'zslice',
- )
-
- def test(self):
- dev = self.dev
- ctx = self.ctx
-
- target = self.target
- format = self.format
- width = self.width
- height = self.height
- depth = self.depth
- last_level = self.last_level
- face = self.face
- level = self.level
- zslice = self.zslice
-
- bind = PIPE_BIND_SAMPLER_VIEW
- geom_flags = 0
- sample_count = 0
- if not dev.is_format_supported(format, target, sample_count, bind, geom_flags):
- raise TestSkip
-
- if not dev.is_format_supported(format, target, sample_count, bind, geom_flags):
- raise TestSkip
-
- # textures
- dst_texture = dev.resource_create(
- target = target,
- format = format,
- width = width,
- height = height,
- depth = depth,
- last_level = last_level,
- bind = bind,
- )
-
- dst_surface = dst_texture.get_surface(face = face, level = level, zslice = zslice)
-
- src_texture = dev.resource_create(
- target = target,
- format = format,
- width = dst_surface.width,
- height = dst_surface.height,
- depth = 1,
- last_level = 0,
- bind = PIPE_BIND_SAMPLER_VIEW,
- )
-
- src_surface = src_texture.get_surface()
-
- w = dst_surface.width
- h = dst_surface.height
-
- stride = util_format_get_stride(format, w)
- size = util_format_get_nblocksy(format, h) * stride
- src_raw = os.urandom(size)
-
- ctx.surface_write_raw(src_surface, 0, 0, w, h, src_raw, stride)
-
- ctx.surface_copy(dst_surface, 0, 0,
- src_surface, 0, 0, w, h)
-
- dst_raw = ctx.surface_read_raw(dst_surface, 0, 0, w, h)
-
- if dst_raw != src_raw:
- raise TestFailure
-
-
-def main():
- dev = Device()
- ctx = dev.context_create()
- suite = TestSuite()
-
- targets = [
- PIPE_TEXTURE_2D,
- PIPE_TEXTURE_CUBE,
- PIPE_TEXTURE_3D,
- ]
-
- sizes = [64, 32, 16, 8, 4, 2, 1]
- #sizes = [1020, 508, 252, 62, 30, 14, 6, 3]
- #sizes = [64]
- #sizes = [63]
-
- faces = [
- PIPE_TEX_FACE_POS_X,
- PIPE_TEX_FACE_NEG_X,
- PIPE_TEX_FACE_POS_Y,
- PIPE_TEX_FACE_NEG_Y,
- PIPE_TEX_FACE_POS_Z,
- PIPE_TEX_FACE_NEG_Z,
- ]
-
- try:
- n = int(sys.argv[1])
- except:
- n = 10000
-
- for i in range(n):
- format = random.choice(formats.keys())
- if not util_format_is_depth_or_stencil(format):
- is_depth_or_stencil = util_format_is_depth_or_stencil(format)
-
- if is_depth_or_stencil:
- target = PIPE_TEXTURE_2D
- else:
- target = random.choice(targets)
-
- size = random.choice(sizes)
-
- if target == PIPE_TEXTURE_3D:
- depth = size
- else:
- depth = 1
-
- if target == PIPE_TEXTURE_CUBE:
- face = random.choice(faces)
- else:
- face = PIPE_TEX_FACE_POS_X
-
- levels = lods(size)
- last_level = random.randint(0, levels - 1)
- level = random.randint(0, last_level)
- zslice = random.randint(0, max(depth >> level, 1) - 1)
-
- test = TextureTest(
- dev = dev,
- ctx = ctx,
- target = target,
- format = format,
- width = size,
- height = size,
- depth = depth,
- last_level = last_level,
- face = face,
- level = level,
- zslice = zslice,
- )
- suite.add_test(test)
- suite.run()
-
-
-if __name__ == '__main__':
- main()
diff --git a/src/gallium/tests/python/tests/texture_blit.py b/src/gallium/tests/python/tests/texture_blit.py
deleted file mode 100755
index 089d05c6237..00000000000
--- a/src/gallium/tests/python/tests/texture_blit.py
+++ /dev/null
@@ -1,638 +0,0 @@
-#!/usr/bin/env python
-##########################################################################
-#
-# Copyright 2009 VMware, Inc.
-# Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
-# All Rights Reserved.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sub license, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice (including the
-# next paragraph) shall be included in all copies or substantial portions
-# of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-# IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
-# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-##########################################################################
-
-
-import random
-
-from gallium import *
-from base import *
-
-
-def lods(*dims):
- size = max(dims)
- lods = 0
- while size:
- lods += 1
- size >>= 1
- return lods
-
-
-def minify(dims, level = 1):
- return [max(dim>>level, 1) for dim in dims]
-
-
-def tex_coords(texture, face, level, zslice):
- st = [
- [0.0, 0.0],
- [1.0, 0.0],
- [1.0, 1.0],
- [0.0, 1.0],
- ]
-
- if texture.target == PIPE_TEXTURE_2D or texture.target == PIPE_TEXTURE_RECT:
- return [[s, t, 0.0] for s, t in st]
- elif texture.target == PIPE_TEXTURE_3D:
- depth = texture.get_depth(level)
- if depth > 1:
- r = float(zslice)/float(depth - 1)
- else:
- r = 0.0
- return [[s, t, r] for s, t in st]
- elif texture.target == PIPE_TEXTURE_CUBE:
- result = []
- for s, t in st:
- # See http://developer.nvidia.com/object/cube_map_ogl_tutorial.html
- sc = 2.0*s - 1.0
- tc = 2.0*t - 1.0
- if face == PIPE_TEX_FACE_POS_X:
- rx = 1.0
- ry = -tc
- rz = -sc
- if face == PIPE_TEX_FACE_NEG_X:
- rx = -1.0
- ry = -tc
- rz = sc
- if face == PIPE_TEX_FACE_POS_Y:
- rx = sc
- ry = 1.0
- rz = tc
- if face == PIPE_TEX_FACE_NEG_Y:
- rx = sc
- ry = -1.0
- rz = -tc
- if face == PIPE_TEX_FACE_POS_Z:
- rx = sc
- ry = -tc
- rz = 1.0
- if face == PIPE_TEX_FACE_NEG_Z:
- rx = -sc
- ry = -tc
- rz = -1.0
- result.append([rx, ry, rz])
- return result
-
-def is_pot(n):
- return n & (n - 1) == 0
-
-
-class TextureColorSampleTest(TestCase):
-
- tags = (
- 'target',
- 'format',
- 'width',
- 'height',
- 'depth',
- 'last_level',
- 'face',
- 'level',
- 'zslice',
- )
-
- def test(self):
- dev = self.dev
- ctx = self.ctx
-
- target = self.target
- format = self.format
- width = self.width
- height = self.height
- depth = self.depth
- last_level = self.last_level
- face = self.face
- level = self.level
- zslice = self.zslice
- minz = 0.0
- maxz = 1.0
-
- bind = PIPE_BIND_SAMPLER_VIEW
- geom_flags = 0
- sample_count = 0
- if width != height:
- geom_flags |= PIPE_TEXTURE_GEOM_NON_SQUARE
- if not is_pot(width) or not is_pot(height) or not is_pot(depth):
- geom_flags |= PIPE_TEXTURE_GEOM_NON_POWER_OF_TWO
-
- if not dev.is_format_supported(format, target, sample_count, bind, geom_flags):
- raise TestSkip
-
- # disabled blending/masking
- blend = Blend()
- blend.rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE
- blend.rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE
- blend.rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_ZERO
- blend.rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ZERO
- blend.rt[0].colormask = PIPE_MASK_RGBA
- ctx.set_blend(blend)
-
- # no-op depth/stencil/alpha
- depth_stencil_alpha = DepthStencilAlpha()
- ctx.set_depth_stencil_alpha(depth_stencil_alpha)
-
- # rasterizer
- rasterizer = Rasterizer()
- rasterizer.front_winding = PIPE_WINDING_CW
- rasterizer.cull_mode = PIPE_WINDING_NONE
- ctx.set_rasterizer(rasterizer)
-
- # samplers
- sampler = Sampler()
- sampler.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE
- sampler.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE
- sampler.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE
- sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NEAREST
- sampler.min_img_filter = PIPE_TEX_MIPFILTER_NEAREST
- sampler.mag_img_filter = PIPE_TEX_MIPFILTER_NEAREST
- sampler.normalized_coords = 1
- sampler.min_lod = 0
- sampler.max_lod = PIPE_MAX_TEXTURE_LEVELS - 1
- ctx.set_fragment_sampler(0, sampler)
-
- # texture
- texture = dev.resource_create(
- target = target,
- format = format,
- width = width,
- height = height,
- depth = depth,
- last_level = last_level,
- bind = bind,
- )
-
- expected_rgba = FloatArray(height*width*4)
- surface = texture.get_surface(
- face = face,
- level = level,
- zslice = zslice,
- )
-
- ctx.surface_sample_rgba(surface, expected_rgba, True)
-
- ctx.set_fragment_sampler_texture(0, texture)
-
- # viewport
- viewport = Viewport()
- scale = FloatArray(4)
- scale[0] = width
- scale[1] = height
- scale[2] = (maxz - minz) / 2.0
- scale[3] = 1.0
- viewport.scale = scale
- translate = FloatArray(4)
- translate[0] = 0.0
- translate[1] = 0.0
- translate[2] = (maxz - minz) / 2.0
- translate[3] = 0.0
- viewport.translate = translate
- ctx.set_viewport(viewport)
-
- # scissor
- scissor = Scissor()
- scissor.minx = 0
- scissor.miny = 0
- scissor.maxx = width
- scissor.maxy = height
- ctx.set_scissor(scissor)
-
- # clip
- clip = Clip()
- clip.nr = 0
- ctx.set_clip(clip)
-
- # framebuffer
- cbuf_tex = dev.resource_create(
- PIPE_FORMAT_B8G8R8A8_UNORM,
- width,
- height,
- bind = PIPE_BIND_RENDER_TARGET,
- )
-
- cbuf = cbuf_tex.get_surface()
- fb = Framebuffer()
- fb.width = width
- fb.height = height
- fb.nr_cbufs = 1
- fb.set_cbuf(0, cbuf)
- ctx.set_framebuffer(fb)
- rgba = FloatArray(4);
- rgba[0] = 0.5
- rgba[1] = 0.5
- rgba[2] = 0.5
- rgba[3] = 0.5
- ctx.clear(PIPE_CLEAR_COLOR, rgba, 0.0, 0)
- del fb
-
- # vertex shader
- vs = Shader('''
- VERT
- DCL IN[0], POSITION, CONSTANT
- DCL IN[1], GENERIC, CONSTANT
- DCL OUT[0], POSITION, CONSTANT
- DCL OUT[1], GENERIC, CONSTANT
- 0:MOV OUT[0], IN[0]
- 1:MOV OUT[1], IN[1]
- 2:END
- ''')
- #vs.dump()
- ctx.set_vertex_shader(vs)
-
- # fragment shader
- op = {
- PIPE_TEXTURE_1D: "1D",
- PIPE_TEXTURE_2D: "2D",
- PIPE_TEXTURE_3D: "3D",
- PIPE_TEXTURE_CUBE: "CUBE",
- }[target]
- fs = Shader('''
- FRAG
- DCL IN[0], GENERIC[0], LINEAR
- DCL OUT[0], COLOR, CONSTANT
- DCL SAMP[0], CONSTANT
- 0:TEX OUT[0], IN[0], SAMP[0], %s
- 1:END
- ''' % op)
- #fs.dump()
- ctx.set_fragment_shader(fs)
-
- nverts = 4
- nattrs = 2
- verts = FloatArray(nverts * nattrs * 4)
-
- x = 0
- y = 0
- w, h = minify((width, height), level)
-
- pos = [
- [x, y],
- [x+w, y],
- [x+w, y+h],
- [x, y+h],
- ]
-
- tex = tex_coords(texture, face, level, zslice)
-
- for i in range(0, 4):
- j = 8*i
- verts[j + 0] = pos[i][0]/float(width) # x
- verts[j + 1] = pos[i][1]/float(height) # y
- verts[j + 2] = 0.0 # z
- verts[j + 3] = 1.0 # w
- verts[j + 4] = tex[i][0] # s
- verts[j + 5] = tex[i][1] # r
- verts[j + 6] = tex[i][2] # q
- verts[j + 7] = 1.0
-
- ctx.draw_vertices(PIPE_PRIM_TRIANGLE_FAN,
- nverts,
- nattrs,
- verts)
-
- ctx.flush()
-
- cbuf = cbuf_tex.get_surface()
-
- self.assert_rgba(ctx, cbuf, x, y, w, h, expected_rgba, 4.0/256, 0.85)
-
-
-class TextureDepthSampleTest(TestCase):
-
- tags = (
- 'target',
- 'format',
- 'width',
- 'height',
- 'depth',
- 'last_level',
- 'face',
- 'level',
- 'zslice',
- )
-
- def test(self):
- dev = self.dev
- ctx = self.ctx
-
- target = self.target
- format = self.format
- width = self.width
- height = self.height
- depth = self.depth
- last_level = self.last_level
- face = self.face
- level = self.level
- zslice = self.zslice
- minz = 0.0
- maxz = 1.0
-
- bind = PIPE_BIND_SAMPLER_VIEW
- geom_flags = 0
- sample_count = 0
- if width != height:
- geom_flags |= PIPE_TEXTURE_GEOM_NON_SQUARE
- if not is_pot(width) or not is_pot(height) or not is_pot(depth):
- geom_flags |= PIPE_TEXTURE_GEOM_NON_POWER_OF_TWO
-
- if not dev.is_format_supported(format, target, sample_count, bind, geom_flags):
- raise TestSkip
-
- # disabled blending/masking
- blend = Blend()
- blend.rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE
- blend.rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE
- blend.rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_ZERO
- blend.rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ZERO
- blend.rt[0].colormask = PIPE_MASK_RGBA
- ctx.set_blend(blend)
-
- # depth/stencil/alpha
- depth_stencil_alpha = DepthStencilAlpha()
- depth_stencil_alpha.depth.enabled = 1
- depth_stencil_alpha.depth.writemask = 1
- depth_stencil_alpha.depth.func = PIPE_FUNC_LESS
- ctx.set_depth_stencil_alpha(depth_stencil_alpha)
-
- # rasterizer
- rasterizer = Rasterizer()
- rasterizer.front_winding = PIPE_WINDING_CW
- rasterizer.cull_mode = PIPE_WINDING_NONE
- ctx.set_rasterizer(rasterizer)
-
- # viewport
- viewport = Viewport()
- scale = FloatArray(4)
- scale[0] = width
- scale[1] = height
- scale[2] = (maxz - minz) / 2.0
- scale[3] = 1.0
- viewport.scale = scale
- translate = FloatArray(4)
- translate[0] = 0.0
- translate[1] = 0.0
- translate[2] = (maxz - minz) / 2.0
- translate[3] = 0.0
- viewport.translate = translate
- ctx.set_viewport(viewport)
-
- # samplers
- sampler = Sampler()
- sampler.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE
- sampler.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE
- sampler.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE
- sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NEAREST
- sampler.min_img_filter = PIPE_TEX_MIPFILTER_NEAREST
- sampler.mag_img_filter = PIPE_TEX_MIPFILTER_NEAREST
- sampler.normalized_coords = 1
- sampler.min_lod = 0
- sampler.max_lod = PIPE_MAX_TEXTURE_LEVELS - 1
- ctx.set_fragment_sampler(0, sampler)
-
- # texture
- texture = dev.resource_create(
- target = target,
- format = format,
- width = width,
- height = height,
- depth = depth,
- last_level = last_level,
- bind = bind,
- )
-
- expected_rgba = FloatArray(height*width*4)
- surface = texture.get_surface(
- face = face,
- level = level,
- zslice = zslice,
- )
-
- ctx.surface_sample_rgba(surface, expected_rgba, True)
-
- ctx.set_fragment_sampler_texture(0, texture)
-
- # scissor
- scissor = Scissor()
- scissor.minx = 0
- scissor.miny = 0
- scissor.maxx = width
- scissor.maxy = height
- ctx.set_scissor(scissor)
-
- # clip
- clip = Clip()
- clip.nr = 0
- ctx.set_clip(clip)
-
- # framebuffer
- cbuf_tex = dev.resource_create(
- PIPE_FORMAT_B8G8R8A8_UNORM,
- width,
- height,
- bind = PIPE_BIND_RENDER_TARGET,
- )
-
- zsbuf_tex = dev.resource_create(
- PIPE_FORMAT_X8Z24_UNORM,
- width,
- height,
- bind = PIPE_BIND_RENDER_TARGET,
- )
-
- cbuf = cbuf_tex.get_surface()
- zsbuf = zsbuf_tex.get_surface()
- fb = Framebuffer()
- fb.width = width
- fb.height = height
- fb.nr_cbufs = 1
- fb.set_cbuf(0, cbuf)
- fb.set_zsbuf(zsbuf)
- ctx.set_framebuffer(fb)
- rgba = FloatArray(4);
- rgba[0] = 0.5
- rgba[1] = 0.5
- rgba[2] = 0.5
- rgba[3] = 0.5
- ctx.clear(PIPE_CLEAR_DEPTHSTENCIL, rgba, 1.0, 0)
- del fb
-
- # vertex shader
- vs = Shader('''
- VERT
- DCL IN[0], POSITION, CONSTANT
- DCL IN[1], GENERIC, CONSTANT
- DCL OUT[0], POSITION, CONSTANT
- DCL OUT[1], GENERIC, CONSTANT
- 0:MOV OUT[0], IN[0]
- 1:MOV OUT[1], IN[1]
- 2:END
- ''')
- #vs.dump()
- ctx.set_vertex_shader(vs)
-
- # fragment shader
- op = {
- PIPE_TEXTURE_1D: "1D",
- PIPE_TEXTURE_2D: "2D",
- PIPE_TEXTURE_3D: "3D",
- PIPE_TEXTURE_CUBE: "CUBE",
- }[target]
- fs = Shader('''
- FRAG
- DCL IN[0], GENERIC[0], LINEAR
- DCL SAMP[0], CONSTANT
- DCL OUT[0].z, POSITION
- 0:TEX OUT[0].z, IN[0], SAMP[0], %s
- 1:END
- ''' % op)
- #fs.dump()
- ctx.set_fragment_shader(fs)
-
- nverts = 4
- nattrs = 2
- verts = FloatArray(nverts * nattrs * 4)
-
- x = 0
- y = 0
- w, h = minify((width, height), level)
-
- pos = [
- [x, y],
- [x+w, y],
- [x+w, y+h],
- [x, y+h],
- ]
-
- tex = tex_coords(texture, face, level, zslice)
-
- for i in range(0, 4):
- j = 8*i
- verts[j + 0] = pos[i][0]/float(width) # x
- verts[j + 1] = pos[i][1]/float(height) # y
- verts[j + 2] = 0.0 # z
- verts[j + 3] = 1.0 # w
- verts[j + 4] = tex[i][0] # s
- verts[j + 5] = tex[i][1] # r
- verts[j + 6] = tex[i][2] # q
- verts[j + 7] = 1.0
-
- ctx.draw_vertices(PIPE_PRIM_TRIANGLE_FAN,
- nverts,
- nattrs,
- verts)
-
- ctx.flush()
-
- zsbuf = zsbuf_tex.get_surface()
-
- self.assert_rgba(ctx, zsbuf, x, y, w, h, expected_rgba, 4.0/256, 0.85)
-
-
-
-
-def main():
- random.seed(0xdead3eef)
-
- dev = Device()
- ctx = dev.context_create()
- suite = TestSuite()
-
- targets = [
- PIPE_TEXTURE_2D,
- PIPE_TEXTURE_CUBE,
- PIPE_TEXTURE_3D,
- ]
-
- #sizes = [64, 32, 16, 8, 4, 2, 1]
- #sizes = [1020, 508, 252, 62, 30, 14, 6, 3]
- sizes = [64]
- #sizes = [63]
-
- faces = [
- PIPE_TEX_FACE_POS_X,
- PIPE_TEX_FACE_NEG_X,
- PIPE_TEX_FACE_POS_Y,
- PIPE_TEX_FACE_NEG_Y,
- PIPE_TEX_FACE_POS_Z,
- PIPE_TEX_FACE_NEG_Z,
- ]
-
- try:
- n = int(sys.argv[1])
- except:
- n = 10000
-
- for i in range(n):
- format = random.choice(formats.keys())
- if not util_format_is_depth_or_stencil(format):
- is_depth_or_stencil = util_format_is_depth_or_stencil(format)
-
- if is_depth_or_stencil:
- target = PIPE_TEXTURE_2D
- else:
- target = random.choice(targets)
-
- size = random.choice(sizes)
-
- if target == PIPE_TEXTURE_3D:
- depth = size
- else:
- depth = 1
-
- if target == PIPE_TEXTURE_CUBE:
- face = random.choice(faces)
- else:
- face = PIPE_TEX_FACE_POS_X
-
- levels = lods(size)
- last_level = random.randint(0, levels - 1)
- level = random.randint(0, last_level)
- zslice = random.randint(0, max(depth >> level, 1) - 1)
-
- if is_depth_or_stencil:
- klass = TextureDepthSampleTest
- else:
- klass = TextureColorSampleTest
-
- test = klass(
- dev = dev,
- ctx = ctx,
- target = target,
- format = format,
- width = size,
- height = size,
- depth = depth,
- last_level = last_level,
- face = face,
- level = level,
- zslice = zslice,
- )
- suite.add_test(test)
- suite.run()
-
-
-if __name__ == '__main__':
- main()
diff --git a/src/gallium/tests/python/tests/texture_transfer.py b/src/gallium/tests/python/tests/texture_transfer.py
deleted file mode 100755
index 65c919bc64d..00000000000
--- a/src/gallium/tests/python/tests/texture_transfer.py
+++ /dev/null
@@ -1,182 +0,0 @@
-#!/usr/bin/env python
-##########################################################################
-#
-# Copyright 2009 VMware, Inc.
-# Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
-# All Rights Reserved.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sub license, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice (including the
-# next paragraph) shall be included in all copies or substantial portions
-# of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-# IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
-# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-##########################################################################
-
-
-import os
-import random
-
-from gallium import *
-from base import *
-
-
-def lods(*dims):
- size = max(dims)
- lods = 0
- while size:
- lods += 1
- size >>= 1
- return lods
-
-
-class TextureTest(TestCase):
-
- tags = (
- 'target',
- 'format',
- 'width',
- 'height',
- 'depth',
- 'last_level',
- 'face',
- 'level',
- 'zslice',
- )
-
- def test(self):
- dev = self.dev
- ctx = self.ctx
-
- target = self.target
- format = self.format
- width = self.width
- height = self.height
- depth = self.depth
- last_level = self.last_level
- face = self.face
- level = self.level
- zslice = self.zslice
-
- bind = PIPE_BIND_SAMPLER_VIEW
- geom_flags = 0
- sample_count = 0
- if not dev.is_format_supported(format, target, sample_count, bind, geom_flags):
- raise TestSkip
-
- # textures
- texture = dev.resource_create(
- target = target,
- format = format,
- width = width,
- height = height,
- depth = depth,
- last_level = last_level,
- bind = bind,
- )
-
- surface = texture.get_surface(face, level, zslice)
-
- stride = util_format_get_stride(format, surface.width)
- size = util_format_get_nblocksy(format, surface.height) * stride
-
- in_raw = os.urandom(size)
-
- ctx.surface_write_raw(surface, 0, 0, surface.width, surface.height, in_raw, stride)
-
- out_raw = ctx.surface_read_raw(surface, 0, 0, surface.width, surface.height)
-
- if in_raw != out_raw:
- raise TestFailure
-
-
-def main():
- dev = Device()
- ctx = dev.context_create()
- suite = TestSuite()
-
- targets = [
- PIPE_TEXTURE_2D,
- PIPE_TEXTURE_CUBE,
- PIPE_TEXTURE_3D,
- ]
-
- sizes = [64, 32, 16, 8, 4, 2, 1]
- #sizes = [1020, 508, 252, 62, 30, 14, 6, 3]
- #sizes = [64]
- #sizes = [63]
-
- faces = [
- PIPE_TEX_FACE_POS_X,
- PIPE_TEX_FACE_NEG_X,
- PIPE_TEX_FACE_POS_Y,
- PIPE_TEX_FACE_NEG_Y,
- PIPE_TEX_FACE_POS_Z,
- PIPE_TEX_FACE_NEG_Z,
- ]
-
- try:
- n = int(sys.argv[1])
- except:
- n = 10000
-
- for i in range(n):
- format = random.choice(formats.keys())
- if not util_format_is_depth_or_stencil(format):
- is_depth_or_stencil = util_format_is_depth_or_stencil(format)
-
- if is_depth_or_stencil:
- target = PIPE_TEXTURE_2D
- else:
- target = random.choice(targets)
-
- size = random.choice(sizes)
-
- if target == PIPE_TEXTURE_3D:
- depth = size
- else:
- depth = 1
-
- if target == PIPE_TEXTURE_CUBE:
- face = random.choice(faces)
- else:
- face = PIPE_TEX_FACE_POS_X
-
- levels = lods(size)
- last_level = random.randint(0, levels - 1)
- level = random.randint(0, last_level)
- zslice = random.randint(0, max(depth >> level, 1) - 1)
-
- test = TextureTest(
- dev = dev,
- ctx = ctx,
- target = target,
- format = format,
- width = size,
- height = size,
- depth = depth,
- last_level = last_level,
- face = face,
- level = level,
- zslice = zslice,
- )
- suite.add_test(test)
- suite.run()
-
-
-if __name__ == '__main__':
- main()
diff --git a/src/gallium/tests/unit/SConscript b/src/gallium/tests/unit/SConscript
index 49f28c03691..edc1e80a412 100644
--- a/src/gallium/tests/unit/SConscript
+++ b/src/gallium/tests/unit/SConscript
@@ -19,13 +19,13 @@ progs = [
'translate_test'
]
-for prog in progs:
+for progname in progs:
prog = env.Program(
- target = prog,
- source = prog + '.c',
+ target = progname,
+ source = progname + '.c',
)
- env.InstallProgram(prog)
+ env.Alias(progname, env.InstallProgram(prog))
# http://www.scons.org/wiki/UnitTests
test_alias = env.Alias('unit', [prog], prog[0].abspath)
diff --git a/src/gallium/tests/unit/translate_test.c b/src/gallium/tests/unit/translate_test.c
index d0946a91a26..2976fb79227 100644
--- a/src/gallium/tests/unit/translate_test.c
+++ b/src/gallium/tests/unit/translate_test.c
@@ -57,6 +57,7 @@ int main(int argc, char** argv)
unsigned char* byte_buffer;
float* float_buffer;
double* double_buffer;
+ unsigned * elts;
unsigned count = 4;
unsigned i, j, k;
unsigned passed = 0;
@@ -137,6 +138,8 @@ int main(int argc, char** argv)
float_buffer = align_malloc(buffer_size, 4096);
double_buffer = align_malloc(buffer_size, 4096);
+ elts = align_malloc(count * sizeof *elts, 4096);
+
key.nr_elements = 1;
key.element[0].input_buffer = 0;
key.element[0].input_offset = 0;
@@ -156,6 +159,9 @@ int main(int argc, char** argv)
for (i = 0; i < buffer_size / sizeof(double); ++i)
double_buffer[i] = rand_double();
+ for (i = 0; i < count; ++i)
+ elts[i] = i;
+
for (output_format = 1; output_format < PIPE_FORMAT_COUNT; ++output_format)
{
const struct util_format_description* output_format_desc = util_format_description(output_format);
@@ -245,14 +251,14 @@ int main(int argc, char** argv)
else
buffer[0] = byte_buffer;
- translate[0]->set_buffer(translate[0], 0, buffer[0], input_format_size, ~0);
- translate[0]->run(translate[0], 0, count, 0, buffer[1]);
- translate[1]->set_buffer(translate[1], 0, buffer[1], output_format_size, ~0);
- translate[1]->run(translate[1], 0, count, 0, buffer[2]);
- translate[0]->set_buffer(translate[0], 0, buffer[2], input_format_size, ~0);
- translate[0]->run(translate[0], 0, count, 0, buffer[3]);
- translate[1]->set_buffer(translate[1], 0, buffer[3], output_format_size, ~0);
- translate[1]->run(translate[1], 0, count, 0, buffer[4]);
+ translate[0]->set_buffer(translate[0], 0, buffer[0], input_format_size, count - 1);
+ translate[0]->run_elts(translate[0], elts, count, 0, buffer[1]);
+ translate[1]->set_buffer(translate[1], 0, buffer[1], output_format_size, count - 1);
+ translate[1]->run_elts(translate[1], elts, count, 0, buffer[2]);
+ translate[0]->set_buffer(translate[0], 0, buffer[2], input_format_size, count - 1);
+ translate[0]->run_elts(translate[0], elts, count, 0, buffer[3]);
+ translate[1]->set_buffer(translate[1], 0, buffer[3], output_format_size, count - 1);
+ translate[1]->run_elts(translate[1], elts, count, 0, buffer[4]);
for (i = 0; i < count; ++i)
{