Add more structure constructor tests.
[piglit/hramrach.git] / tests / asmparsertest / vp-tex.sh
blob09a0b1c029be79293403f8fe56c5f41971dedbd7
1 #!/bin/sh
3 # Copyright © 2009 Intel Corporation
5 # Permission is hereby granted, free of charge, to any person obtaining a
6 # copy of this software and associated documentation files (the "Software"),
7 # to deal in the Software without restriction, including without limitation
8 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 # and/or sell copies of the Software, and to permit persons to whom the
10 # Software is furnished to do so, subject to the following conditions:
12 # The above copyright notice and this permission notice (including the next
13 # paragraph) shall be included in all copies or substantial portions of the
14 # Software.
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 # DEALINGS IN THE SOFTWARE.
24 # Generate a bunch of vertex program texture tests
26 # Authors: Ian Romanick <ian.d.romanick@intel.com>
28 function emit_target_require
30 t=$1
31 if echo $t | grep -q ^SHADOW ; then
32 echo "# REQUIRE GL_ARB_fragment_program_shadow"
33 echo "OPTION ARB_fragment_program_shadow;"
34 t=$(echo $t | sed 's/^SHADOW//')
36 if [ "$t" = "RECT" ]; then
37 echo "# REQUIRE GL_ARB_texture_rectangle"
39 if [ "$t" = "CUBE" ]; then
40 echo "# REQUIRE GL_ARB_texture_cube_map"
42 if [ "$t" = "3D" ]; then
43 echo "# REQUIRE GL_EXT_texture3D"
48 function emit_fail_NVvp3
50 if ! echo "$1" | egrep -q '(TEX|TX[BLP])'; then
51 printf '# FAIL - %s not supported by GL_NV_vertex_program3\n' "$1"
55 function emit_shader_ARBvp
57 echo '!!ARBvp1.0'
59 emit_target_require $2
61 echo '# FAIL - texture instructions not supported by GL_ARB_vertex_program'
62 printf '%s result.color, vertex.texcoord[0], texture[0], %s;\n' "$1" "$2"
63 echo 'END'
67 function emit_shader_NVvp3
69 echo '!!ARBvp1.0'
70 echo "# REQUIRE GL_NV_vertex_program3"
72 echo "OPTION NV_vertex_program3;"
73 emit_target_require $2
74 emit_fail_NVvp3 $1
76 echo ""
77 printf '%s result.color, vertex.texcoord[0], texture[0], %s;\n' "$1" "$2"
78 echo 'END'
83 function emit_shader_NVvp3_alt
85 echo '!!ARBvp1.0'
86 echo "# REQUIRE GL_NV_vertex_program3"
88 echo "OPTION NV_vertex_program3;"
89 emit_target_require $2
90 emit_fail_NVvp3 $1
92 echo ""
93 printf 'OUTPUT %s = result.color;\n' "$2"
94 printf '%s %s, vertex.texcoord[0], texture[0], %s;\n' "$1" "$2" "$2"
95 echo 'END'
99 path=shaders/ARBvp1.0
100 # VP3 VP3 FP GP4 VP3 VP3 GP4
101 for inst in TEX TXB TXD TXF TXL TXP TXQ; do
102 inst_low=$(echo $inst | awk '{print tolower($1);}')
105 for target in 1D 2D 3D CUBE RECT SHADOW1D SHADOW2D; do
106 file=$(printf "%s-%02d.txt" $inst_low $i)
108 emit_shader_ARBvp $inst $target > $path/$file
109 i=$((i + 1))
110 done
112 for target in 1D 2D 3D CUBE RECT SHADOW1D SHADOW2D; do
113 file=$(printf "%s-%02d.txt" $inst_low $i)
115 emit_shader_NVvp3 $inst $target > $path/$file
116 i=$((i + 1))
117 done
119 for target in CUBE RECT; do
120 file=$(printf "%s-%02d.txt" $inst_low $i)
122 emit_shader_NVvp3_alt $inst $target > $path/$file
123 i=$((i + 1))
124 done
126 # Add this set of tests cases here so that the tests from the previous
127 # don't get re-numbered. This prevents unnecessary churn in the diffs.
128 for target in SHADOWRECT; do
129 file=$(printf "%s-%02d.txt" $inst_low $i)
131 emit_shader_NVvp3 $inst $target > $path/$file
132 i=$((i + 1))
133 done
135 for target in SHADOW1D SHADOW2D SHADOWRECT; do
136 file=$(printf "%s-%02d.txt" $inst_low $i)
138 emit_shader_NVvp3_alt $inst $target > $path/$file
139 i=$((i + 1))
140 done
141 done