aboutsummaryrefslogtreecommitdiff
path: root/tests/shaders/generic
diff options
context:
space:
mode:
authorTom Stellard <tstellar@gmail.com>2010-09-25 22:02:10 -0700
committerMarek Olšák <maraeo@gmail.com>2010-09-27 12:32:10 +0200
commit817c4242b625fd19c7abf7c8d1b347482d411254 (patch)
tree332faa2f3d28245bb7cf7493b25cf1517583b292 /tests/shaders/generic
parent97f093f7614d949443449a6faf8878a3ecc15b31 (diff)
fdo30337{a,b}: New tests for radeon presubtract.
Diffstat (limited to 'tests/shaders/generic')
-rw-r--r--tests/shaders/generic/fdo30337a.vpfp17
-rw-r--r--tests/shaders/generic/fdo30337b.vpfp25
2 files changed, 42 insertions, 0 deletions
diff --git a/tests/shaders/generic/fdo30337a.vpfp b/tests/shaders/generic/fdo30337a.vpfp
new file mode 100644
index 00000000..48b97d73
--- /dev/null
+++ b/tests/shaders/generic/fdo30337a.vpfp
@@ -0,0 +1,17 @@
+!!ARBvp1.0
+OPTION ARB_position_invariant;
+END
+
+!!ARBfp1.0
+#This tests instructions like: ADD Temp[0], Temp[0], Temp[1] where one of
+#the source registers is the same as the destination register. These
+#should not be replaced with presubtract operations.
+TEMP color;
+MOV color, {0.1, 0.4, 0.8, 1.0};
+ADD color.x, color.x, color.x;
+ADD color.y, color.x, color.y;
+MOV result.color, color;
+END
+
+!!test
+expected 0.2 0.6 0.8 1.0
diff --git a/tests/shaders/generic/fdo30337b.vpfp b/tests/shaders/generic/fdo30337b.vpfp
new file mode 100644
index 00000000..e6809fc2
--- /dev/null
+++ b/tests/shaders/generic/fdo30337b.vpfp
@@ -0,0 +1,25 @@
+!!ARBvp1.0
+OPTION ARB_position_invariant;
+END
+
+!!ARBfp1.0
+#This test is for instructions that read from more components than the
+#presubtract operation writes. For example:
+#ADD Temp[0].x Temp[1].x, Temp[2].x
+#MUL Temp[4]x. Temp[0].x, Temp[5].x
+#DP3 Temp[6].x Temp[0].xyz, Temp[0].xyz
+#The ADD instruction can be converted to a presubtract operation and be
+#used by the MUL instruction, but it cannot be used by the DP3 instruction
+#since that instruction reads from more than just the x component of Temp[0].
+#Therefore the ADD instruction should not be removed.
+TEMP color;
+MOV color, {0.1, 0.4, 0.8, 1.0};
+SUB color.x, color.x, color.x;
+ADD color.y, color.x, color.y;
+SUB color.z, color.x, color.x;
+DP3 color.w, color, color;
+MOV result.color, color;
+END
+
+!!test
+expected 0.0 0.4 0.0 0.16