glsl: Add '.ir' extension to builtin IR files
authorPaul Berry <stereotype441@gmail.com>
Thu, 6 Oct 2011 17:31:34 +0000 (10:31 -0700)
committerPaul Berry <stereotype441@gmail.com>
Mon, 31 Oct 2011 18:24:03 +0000 (11:24 -0700)
This patch adds the extension '.ir' to all the files in
src/glsl/builtins/ir/, and changes generate_builtins.py so that it no
longer globs on '*' to find the files to build.  This prevents
spurious files (such as EMACS' infamous *~ backup files) from breaking
the build.

66 files changed:
src/glsl/builtins/ir/abs.ir [moved from src/glsl/builtins/ir/abs with 100% similarity]
src/glsl/builtins/ir/acos.ir [moved from src/glsl/builtins/ir/acos with 100% similarity]
src/glsl/builtins/ir/acosh.ir [moved from src/glsl/builtins/ir/acosh with 100% similarity]
src/glsl/builtins/ir/all.ir [moved from src/glsl/builtins/ir/all with 100% similarity]
src/glsl/builtins/ir/any.ir [moved from src/glsl/builtins/ir/any with 100% similarity]
src/glsl/builtins/ir/asin.ir [moved from src/glsl/builtins/ir/asin with 100% similarity]
src/glsl/builtins/ir/asinh.ir [moved from src/glsl/builtins/ir/asinh with 100% similarity]
src/glsl/builtins/ir/atan.ir [moved from src/glsl/builtins/ir/atan with 100% similarity]
src/glsl/builtins/ir/atanh.ir [moved from src/glsl/builtins/ir/atanh with 100% similarity]
src/glsl/builtins/ir/ceil.ir [moved from src/glsl/builtins/ir/ceil with 100% similarity]
src/glsl/builtins/ir/clamp.ir [moved from src/glsl/builtins/ir/clamp with 100% similarity]
src/glsl/builtins/ir/cos.ir [moved from src/glsl/builtins/ir/cos with 100% similarity]
src/glsl/builtins/ir/cosh.ir [moved from src/glsl/builtins/ir/cosh with 100% similarity]
src/glsl/builtins/ir/cross.ir [moved from src/glsl/builtins/ir/cross with 100% similarity]
src/glsl/builtins/ir/dFdx.ir [moved from src/glsl/builtins/ir/dFdx with 100% similarity]
src/glsl/builtins/ir/dFdy.ir [moved from src/glsl/builtins/ir/dFdy with 100% similarity]
src/glsl/builtins/ir/degrees.ir [moved from src/glsl/builtins/ir/degrees with 100% similarity]
src/glsl/builtins/ir/distance.ir [moved from src/glsl/builtins/ir/distance with 100% similarity]
src/glsl/builtins/ir/dot.ir [moved from src/glsl/builtins/ir/dot with 100% similarity]
src/glsl/builtins/ir/equal.ir [moved from src/glsl/builtins/ir/equal with 100% similarity]
src/glsl/builtins/ir/exp.ir [moved from src/glsl/builtins/ir/exp with 100% similarity]
src/glsl/builtins/ir/exp2.ir [moved from src/glsl/builtins/ir/exp2 with 100% similarity]
src/glsl/builtins/ir/faceforward.ir [moved from src/glsl/builtins/ir/faceforward with 100% similarity]
src/glsl/builtins/ir/floor.ir [moved from src/glsl/builtins/ir/floor with 100% similarity]
src/glsl/builtins/ir/fract.ir [moved from src/glsl/builtins/ir/fract with 100% similarity]
src/glsl/builtins/ir/ftransform.ir [moved from src/glsl/builtins/ir/ftransform with 100% similarity]
src/glsl/builtins/ir/fwidth.ir [moved from src/glsl/builtins/ir/fwidth with 100% similarity]
src/glsl/builtins/ir/greaterThan.ir [moved from src/glsl/builtins/ir/greaterThan with 100% similarity]
src/glsl/builtins/ir/greaterThanEqual.ir [moved from src/glsl/builtins/ir/greaterThanEqual with 100% similarity]
src/glsl/builtins/ir/inversesqrt.ir [moved from src/glsl/builtins/ir/inversesqrt with 100% similarity]
src/glsl/builtins/ir/length.ir [moved from src/glsl/builtins/ir/length with 100% similarity]
src/glsl/builtins/ir/lessThan.ir [moved from src/glsl/builtins/ir/lessThan with 100% similarity]
src/glsl/builtins/ir/lessThanEqual.ir [moved from src/glsl/builtins/ir/lessThanEqual with 100% similarity]
src/glsl/builtins/ir/log.ir [moved from src/glsl/builtins/ir/log with 100% similarity]
src/glsl/builtins/ir/log2.ir [moved from src/glsl/builtins/ir/log2 with 100% similarity]
src/glsl/builtins/ir/matrixCompMult.ir [moved from src/glsl/builtins/ir/matrixCompMult with 100% similarity]
src/glsl/builtins/ir/max.ir [moved from src/glsl/builtins/ir/max with 100% similarity]
src/glsl/builtins/ir/min.ir [moved from src/glsl/builtins/ir/min with 100% similarity]
src/glsl/builtins/ir/mix.ir [moved from src/glsl/builtins/ir/mix with 100% similarity]
src/glsl/builtins/ir/mod.ir [moved from src/glsl/builtins/ir/mod with 100% similarity]
src/glsl/builtins/ir/modf.ir [moved from src/glsl/builtins/ir/modf with 100% similarity]
src/glsl/builtins/ir/noise1.ir [moved from src/glsl/builtins/ir/noise1 with 100% similarity]
src/glsl/builtins/ir/noise2.ir [moved from src/glsl/builtins/ir/noise2 with 100% similarity]
src/glsl/builtins/ir/noise3.ir [moved from src/glsl/builtins/ir/noise3 with 100% similarity]
src/glsl/builtins/ir/noise4.ir [moved from src/glsl/builtins/ir/noise4 with 100% similarity]
src/glsl/builtins/ir/normalize.ir [moved from src/glsl/builtins/ir/normalize with 100% similarity]
src/glsl/builtins/ir/not.ir [moved from src/glsl/builtins/ir/not with 100% similarity]
src/glsl/builtins/ir/notEqual.ir [moved from src/glsl/builtins/ir/notEqual with 100% similarity]
src/glsl/builtins/ir/outerProduct.ir [moved from src/glsl/builtins/ir/outerProduct with 100% similarity]
src/glsl/builtins/ir/pow.ir [moved from src/glsl/builtins/ir/pow with 100% similarity]
src/glsl/builtins/ir/radians.ir [moved from src/glsl/builtins/ir/radians with 100% similarity]
src/glsl/builtins/ir/reflect.ir [moved from src/glsl/builtins/ir/reflect with 100% similarity]
src/glsl/builtins/ir/refract.ir [moved from src/glsl/builtins/ir/refract with 100% similarity]
src/glsl/builtins/ir/round.ir [moved from src/glsl/builtins/ir/round with 100% similarity]
src/glsl/builtins/ir/roundEven.ir [moved from src/glsl/builtins/ir/roundEven with 100% similarity]
src/glsl/builtins/ir/sign.ir [moved from src/glsl/builtins/ir/sign with 100% similarity]
src/glsl/builtins/ir/sin.ir [moved from src/glsl/builtins/ir/sin with 100% similarity]
src/glsl/builtins/ir/sinh.ir [moved from src/glsl/builtins/ir/sinh with 100% similarity]
src/glsl/builtins/ir/smoothstep.ir [moved from src/glsl/builtins/ir/smoothstep with 100% similarity]
src/glsl/builtins/ir/sqrt.ir [moved from src/glsl/builtins/ir/sqrt with 100% similarity]
src/glsl/builtins/ir/step.ir [moved from src/glsl/builtins/ir/step with 100% similarity]
src/glsl/builtins/ir/tan.ir [moved from src/glsl/builtins/ir/tan with 100% similarity]
src/glsl/builtins/ir/tanh.ir [moved from src/glsl/builtins/ir/tanh with 100% similarity]
src/glsl/builtins/ir/transpose.ir [moved from src/glsl/builtins/ir/transpose with 100% similarity]
src/glsl/builtins/ir/trunc.ir [moved from src/glsl/builtins/ir/trunc with 100% similarity]
src/glsl/builtins/tools/generate_builtins.py

index 8ce2b70..b8c12bc 100755 (executable)
@@ -24,9 +24,10 @@ compiler = argv[1]
 
 # Read the files in builtins/ir/*...add them to the supplied dictionary.
 def read_ir_files(fs):
-    for filename in glob(path.join(path.join(builtins_dir, 'ir'), '*')):
+    for filename in glob(path.join(path.join(builtins_dir, 'ir'), '*.ir')):
+        function_name = path.basename(filename).split('.')[0]
         with open(filename) as f:
-            fs[path.basename(filename)] = f.read()
+            fs[function_name] = f.read()
 
 # Return a dictionary containing all builtin definitions (even generated)
 def get_builtin_definitions():
@@ -103,8 +104,13 @@ def write_profiles():
         write_profile(filename, profile)
 
 def get_profile_list():
+    profile_files = []
+    for extension in ['frag', 'vert']:
+        path_glob = path.join(
+            path.join(builtins_dir, 'profiles'), '*.' + extension)
+        profile_files.extend(glob(path_glob))
     profiles = []
-    for pfile in sorted(glob(path.join(path.join(builtins_dir, 'profiles'), '*'))):
+    for pfile in sorted(profile_files):
         profiles.append((pfile, path.basename(pfile).replace('.', '_')))
     return profiles