1 | #!/bin/sh |
1 | #!/bin/sh |
2 | |
2 | |
3 | # extracts various bits of data form OpenCL heder files, which are expected to |
3 | # extracts various bits of data form OpenCL heder files, which are expected to |
4 | # be in CL/ |
4 | # be in CL/ |
5 | |
5 | |
|
|
6 | ALL_H="CL/cl.h CL/cl_ext.h CL/cl_gl.h CL/cl_gl_ext.h CL/cl_d3d10.h CL12/cl_d3d11.h CL/cl_dx9_media_sharing.h" |
|
|
7 | |
6 | # constants |
8 | # constants |
7 | cat CL/cl.h CL/cl_ext.h CL/cl_gl.h CL/cl_gl_ext.h CL/cl_d3d10.h | |
9 | ( |
8 | perl -ne 'print "#ifdef CL_$1\nconst_iv($1)\n#endif\n" if /^#define CL_(\S+)/' >constiv.h |
10 | echo '// autogenerated by h_extract' |
|
|
11 | cat $ALL_H | |
|
|
12 | perl -ne 'print "const_iv($1)\n" if /^#define CL_(\S+)/' |
|
|
13 | cat CL/cl_platform.h | |
|
|
14 | perl -ne 'print "const_iv($1)\n" if /^#define CL_(\S+)\s+[^.]+\s*$/' | |
|
|
15 | sort | uniq | |
|
|
16 | perl -ne 'print unless /const_iv\((?:MAXFLOAT|INFINITY|NAN|HUGE_VALF?)\)/' |
|
|
17 | ) >constiv.h |
|
|
18 | |
|
|
19 | # fp constants |
|
|
20 | ( |
|
|
21 | echo '// autogenerated by h_extract' |
|
|
22 | cat CL/cl_platform.h | |
|
|
23 | perl -ne 'print "const_nv($1)\n" if /^#define\s+CL_(\S+)\s+.*\..*\s*$/' |
|
|
24 | echo "const_nv(MAXFLOAT)" |
|
|
25 | echo "const_nv(INFINITY)" |
|
|
26 | echo "const_nv(HUGE_VAL)" |
|
|
27 | echo "const_nv(HUGE_VALF)" |
|
|
28 | ) >constnv.h |
9 | |
29 | |
10 | # constants that look like enum values |
30 | # constants that look like enum values |
11 | cat CL/cl.h CL/cl_ext.h CL/cl_gl.h CL/cl_gl_ext.h CL/cl_d3d10.h | |
31 | ( |
|
|
32 | echo '// autogenerated by h_extract' |
|
|
33 | cat $ALL_H | |
12 | perl -ne 'print "#ifdef CL_$1\nconst_iv($1)\n#endif\n" if /^#define CL_(\S+)\s+0x[0-9a-fA-F]{4}/' >enumstr.h |
34 | perl -ne 'print "const_iv($1)\n" if /^#define CL_(\S+)\s+0x[0-9a-fA-F]{4}/' |
|
|
35 | ) >enumstr.h |
|
|
36 | |
|
|
37 | # error codes |
|
|
38 | ( |
|
|
39 | echo '// autogenerated by h_extract' |
|
|
40 | echo "const_iv(SUCCESS)" |
|
|
41 | cat $ALL_H | |
|
|
42 | perl -ne 'print "const_iv($1)\n" if !/#define CL_BUILD_(?:NONE|ERROR|IN_PROGRESS)/ && /^#define CL_(\S+)\s+-\d+\s*$/' |
|
|
43 | ) >errstr.h |
|
|
44 | |
|
|
45 | # default constant values to -1 |
|
|
46 | ( |
|
|
47 | echo '// autogenerated by h_extract' |
|
|
48 | cat constiv.h | |
|
|
49 | perl -ne '/const_iv\((.*)\)/ or next; print "#ifndef CL_$1\n#define CL_$1 -1\n#endif\n"' |
|
|
50 | ) >default.h |
13 | |
51 | |
14 | # *glGet*Info |
52 | # *glGet*Info |
15 | ( |
53 | ( |
16 | <CL/cl.hpp perl -ne 'print "$1\n" if /^\s*F\((.*)\)\s*\\?\s*$/' |
54 | <CL/cl.hpp perl -ne 'print "$1\n" if /^\s*F\((.*)\)\s*\\?\s*$/' |
17 | # DEVICE_DOUBLE_FP_CONFIG |
55 | # DEVICE_DOUBLE_FP_CONFIG |
… | |
… | |
26 | # DEVICE_KERNEL_EXEC_TIMEOUT_NV |
64 | # DEVICE_KERNEL_EXEC_TIMEOUT_NV |
27 | # DEVICE_INTEGRATED_MEMORY_NV |
65 | # DEVICE_INTEGRATED_MEMORY_NV |
28 | # DEVICE_PROFILING_TIMER_OFFSET_AMD |
66 | # DEVICE_PROFILING_TIMER_OFFSET_AMD |
29 | |
67 | |
30 | cat <<EOF |
68 | cat <<EOF |
|
|
69 | cl_program_build_info, CL_PROGRAM_BINARY_TYPE, cl_program_binary_type |
31 | cl_gl_texture_info, CL_GL_TEXTURE_TARGET, cl_GLenum |
70 | cl_gl_texture_info, CL_GL_TEXTURE_TARGET, cl_GLenum |
32 | cl_gl_texture_info, CL_GL_MIPMAP_LEVEL, cl_GLint |
71 | cl_gl_texture_info, CL_GL_MIPMAP_LEVEL, cl_GLint |
33 | cl_kernel_arg_info, CL_KERNEL_ARG_ADDRESS_QUALIFIER, cl_kernel_arg_address_qualifier |
72 | cl_kernel_arg_info, CL_KERNEL_ARG_ADDRESS_QUALIFIER, cl_kernel_arg_address_qualifier |
34 | cl_kernel_arg_info, CL_KERNEL_ARG_ACCESS_QUALIFIER, cl_kernel_arg_access_qualifier |
73 | cl_kernel_arg_info, CL_KERNEL_ARG_ACCESS_QUALIFIER, cl_kernel_arg_access_qualifier |
35 | cl_kernel_arg_info, CL_KERNEL_ARG_TYPE_NAME, STRING_CLASS |
74 | cl_kernel_arg_info, CL_KERNEL_ARG_TYPE_NAME, STRING_CLASS |
36 | cl_kernel_arg_info, CL_KERNEL_ARG_TYPE_QUALIFIER, cl_kernel_arg_type_qualifier |
75 | cl_kernel_arg_info, CL_KERNEL_ARG_TYPE_QUALIFIER, cl_kernel_arg_type_qualifier |
37 | cl_kernel_arg_info, CL_KERNEL_ARG_NAME, STRING_CLASS |
76 | cl_kernel_arg_info, CL_KERNEL_ARG_NAME, STRING_CLASS |
38 | EOF |
77 | EOF |
39 | ) >getinfo.txt |
78 | ) >getinfo.txt |
40 | |
79 | |
41 | # error codes |
|
|
42 | ( |
|
|
43 | echo "const_iv(SUCCESS)" |
|
|
44 | cat CL/cl.h CL/cl_ext.h CL/cl_gl.h CL/cl_gl_ext.h CL/cl_d3d10.h | |
|
|
45 | perl -ne 'print "#ifdef CL_$1\nconst_iv($1)\n#endif\n" if !/#define CL_BUILD_(?:NONE|ERROR|IN_PROGRESS)/ && /^#define CL_(\S+)\s+-\d+\s*$/' |
|
|
46 | ) >errstr.h |
|
|
47 | |
|
|