diff options
author | Michal Krol <[email protected]> | 2010-01-21 20:03:13 +0100 |
---|---|---|
committer | Michal Krol <[email protected]> | 2010-01-28 14:07:45 +0100 |
commit | 4771e536e16699a0488b68e153de3478dfbc55d0 (patch) | |
tree | 3816c89cff3eb9a728036beaaf633734d928ddba | |
parent | 91d58c3520452798bd1542f86936e0f408182fbf (diff) |
regress: Add two-dimension constant buffer test.
-rw-r--r-- | src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-cb-2d.sh | 9 | ||||
-rw-r--r-- | src/gallium/state_trackers/python/tests/regress/fragment-shader/fragment-shader.py | 38 |
2 files changed, 47 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-cb-2d.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-cb-2d.sh new file mode 100644 index 00000000000..f70a5146f4e --- /dev/null +++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-cb-2d.sh @@ -0,0 +1,9 @@ +FRAG + +DCL IN[0], COLOR, LINEAR +DCL OUT[0], COLOR +DCL CONST[1][1..2] + +MAD OUT[0], IN[0], CONST[1][2], CONST[1][1] + +END diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/fragment-shader.py b/src/gallium/state_trackers/python/tests/regress/fragment-shader/fragment-shader.py index 8d3bf9d4d7e..6a0c1f824bb 100644 --- a/src/gallium/state_trackers/python/tests/regress/fragment-shader/fragment-shader.py +++ b/src/gallium/state_trackers/python/tests/regress/fragment-shader/fragment-shader.py @@ -26,6 +26,7 @@ # ########################################################################## +import struct from gallium import * @@ -146,6 +147,42 @@ def test(dev, name): fs = Shader(file('frag-' + name + '.sh', 'rt').read()) ctx.set_fragment_shader(fs) + constbuf0 = dev.buffer_create(16, + (PIPE_BUFFER_USAGE_CONSTANT | + PIPE_BUFFER_USAGE_GPU_READ | + PIPE_BUFFER_USAGE_CPU_WRITE), + 4 * 4 * 4) + + cbdata = '' + cbdata += struct.pack('4f', 0.5, 0.5, 0.5, 0.5) + cbdata += struct.pack('4f', 0.5, 0.5, 0.5, 0.5) + cbdata += struct.pack('4f', 0.5, 0.5, 0.5, 0.5) + cbdata += struct.pack('4f', 0.5, 0.5, 0.5, 0.5) + + constbuf0.write(cbdata, 0) + + ctx.set_constant_buffer(PIPE_SHADER_FRAGMENT, + 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_FRAGMENT, + 1, + constbuf1) + xy = [ -0.8, -0.8, 0.8, -0.8, @@ -184,6 +221,7 @@ def main(): tests = [ 'abs', 'add', + 'cb-2d', 'dp3', 'dp4', 'dst', |