Mesa (gallium-multiple-constant-buffers): regress: Add vertex shaders tests for constant buffers.
MichaŠKról
michal at kemper.freedesktop.org
Mon Jan 25 13:55:48 UTC 2010
Module: Mesa
Branch: gallium-multiple-constant-buffers
Commit: 7bd5290d2068ccd9748defd9f0fc1930fe728398
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7bd5290d2068ccd9748defd9f0fc1930fe728398
Author: Michal Krol <michal at vmware.com>
Date: Mon Jan 25 12:42:17 2010 +0100
regress: Add vertex shaders tests for constant buffers.
---
.../tests/regress/vertex-shader/vert-cb-1d.sh | 16 ++++++++
.../tests/regress/vertex-shader/vert-cb-2d.sh | 12 ++++++
.../tests/regress/vertex-shader/vertex-shader.py | 40 ++++++++++++++++++++
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 0000000..b41fe5d
--- /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 0000000..45f5e6b
--- /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 01bf5a3..9650377 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',
More information about the mesa-commit
mailing list