summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/python
diff options
context:
space:
mode:
authorMichal Krol <michal@vmware.com>2010-01-25 12:42:17 +0100
committerMichal Krol <michal@vmware.com>2010-01-28 14:07:58 +0100
commit333c035a519a36efd19d2ab227924feb8b0f4c25 (patch)
treee1320c790429ad9f308f4c520ef949f1c11475fd /src/gallium/state_trackers/python
parent9851644435f991a1a1bbb145333a97601627b37d (diff)
regress: Add vertex shaders tests for constant buffers.
Diffstat (limited to 'src/gallium/state_trackers/python')
-rw-r--r--src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-cb-1d.sh16
-rw-r--r--src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-cb-2d.sh12
-rw-r--r--src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py40
3 files changed, 68 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-cb-1d.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-cb-1d.sh
new file mode 100644
index 0000000000..b41fe5dd38
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-cb-1d.sh
@@ -0,0 +1,16 @@
+VERT
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+DCL CONST[1]
+DCL CONST[3]
+DCL TEMP[0..1]
+
+MOV OUT[0], IN[0]
+ADD TEMP[0], IN[1], CONST[1]
+RCP TEMP[1], CONST[3].xxxx
+MUL OUT[1], TEMP[0], TEMP[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-cb-2d.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-cb-2d.sh
new file mode 100644
index 0000000000..45f5e6b729
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-cb-2d.sh
@@ -0,0 +1,12 @@
+VERT
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+DCL CONST[1][1..2]
+
+MOV OUT[0], IN[0]
+MAD OUT[1], IN[1], CONST[1][2], CONST[1][1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py
index 01bf5a3210..96503778ae 100644
--- a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py
+++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py
@@ -27,6 +27,8 @@
##########################################################################
+import struct
+
from gallium import *
def make_image(surface):
@@ -143,6 +145,42 @@ def test(dev, name):
''')
ctx.set_fragment_shader(fs)
+ constbuf0 = dev.buffer_create(64,
+ (PIPE_BUFFER_USAGE_CONSTANT |
+ PIPE_BUFFER_USAGE_GPU_READ |
+ PIPE_BUFFER_USAGE_CPU_WRITE),
+ 4 * 4 * 4)
+
+ cbdata = ''
+ cbdata += struct.pack('4f', 0.4, 0.0, 0.0, 1.0)
+ cbdata += struct.pack('4f', 1.0, 1.0, 1.0, 1.0)
+ cbdata += struct.pack('4f', 2.0, 2.0, 2.0, 2.0)
+ cbdata += struct.pack('4f', 4.0, 8.0, 16.0, 32.0)
+
+ constbuf0.write(cbdata, 0)
+
+ ctx.set_constant_buffer(PIPE_SHADER_VERTEX,
+ 0,
+ constbuf0)
+
+ constbuf1 = dev.buffer_create(64,
+ (PIPE_BUFFER_USAGE_CONSTANT |
+ PIPE_BUFFER_USAGE_GPU_READ |
+ PIPE_BUFFER_USAGE_CPU_WRITE),
+ 4 * 4 * 4)
+
+ cbdata = ''
+ cbdata += struct.pack('4f', 0.1, 0.1, 0.1, 0.1)
+ cbdata += struct.pack('4f', 0.25, 0.25, 0.25, 0.25)
+ cbdata += struct.pack('4f', 0.5, 0.5, 0.5, 0.5)
+ cbdata += struct.pack('4f', 0.75, 0.75, 0.75, 0.75)
+
+ constbuf1.write(cbdata, 0)
+
+ ctx.set_constant_buffer(PIPE_SHADER_VERTEX,
+ 1,
+ constbuf1)
+
xy = [
0.0, 0.8,
-0.2, 0.4,
@@ -213,6 +251,8 @@ def main():
'add',
'arl',
'arr',
+ 'cb-1d',
+ 'cb-2d',
'dp3',
'dp4',
'dst',