ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/OpenCL/h_extract
Revision: 1.10
Committed: Sat May 5 14:51:22 2012 UTC (12 years ago) by root
Branch: MAIN
CVS Tags: rel-1_0
Changes since 1.9: +1 -1 lines
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 root 1.1 #!/bin/sh
2    
3     # extracts various bits of data form OpenCL heder files, which are expected to
4     # be in CL/
5    
6 root 1.7 ALL_H="CL/cl.h CL/cl_ext.h CL/cl_gl.h CL/cl_gl_ext.h CL11/cl_d3d9.h CL/cl_d3d10.h CL12/cl_d3d11.h CL/cl_dx9_media_sharing.h"
7    
8 root 1.1 # constants
9 root 1.6 (
10     echo '// autogenerated by h_extract'
11 root 1.7 cat $ALL_H |
12 root 1.6 perl -ne 'print "const_iv($1)\n" if /^#define CL_(\S+)/'
13 root 1.9 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 root 1.8 ) >constiv.h
18 root 1.1
19 root 1.9 # 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
29    
30 root 1.1 # constants that look like enum values
31 root 1.6 (
32     echo '// autogenerated by h_extract'
33 root 1.7 cat $ALL_H |
34 root 1.6 perl -ne 'print "const_iv($1)\n" if /^#define CL_(\S+)\s+0x[0-9a-fA-F]{4}/'
35 root 1.8 ) >enumstr.h
36 root 1.6
37     # error codes
38     (
39     echo '// autogenerated by h_extract'
40     echo "const_iv(SUCCESS)"
41 root 1.7 cat $ALL_H |
42 root 1.6 perl -ne 'print "const_iv($1)\n" if !/#define CL_BUILD_(?:NONE|ERROR|IN_PROGRESS)/ && /^#define CL_(\S+)\s+-\d+\s*$/'
43 root 1.8 ) >errstr.h
44 root 1.6
45     # default constant values to -1
46     (
47     echo '// autogenerated by h_extract'
48 root 1.8 cat constiv.h |
49 root 1.6 perl -ne '/const_iv\((.*)\)/ or next; print "#ifndef CL_$1\n#define CL_$1 -1\n#endif\n"'
50 root 1.9 ) >default.h
51 root 1.1
52     # *glGet*Info
53 root 1.3 (
54     <CL/cl.hpp perl -ne 'print "$1\n" if /^\s*F\((.*)\)\s*\\?\s*$/'
55     # DEVICE_DOUBLE_FP_CONFIG
56     # DEVICE_HALF_FP_CONFIG
57     # PLATFORM_ICD_SUFFIX_KHR
58     # PLATFORM_NOT_FOUND_KHR
59     # DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
60     # DEVICE_COMPUTE_CAPABILITY_MINOR_NV
61     # DEVICE_REGISTERS_PER_BLOCK_NV
62     # DEVICE_WARP_SIZE_NV
63     # DEVICE_GPU_OVERLAP_NV
64     # DEVICE_KERNEL_EXEC_TIMEOUT_NV
65     # DEVICE_INTEGRATED_MEMORY_NV
66     # DEVICE_PROFILING_TIMER_OFFSET_AMD
67    
68     cat <<EOF
69 root 1.5 cl_program_build_info, CL_PROGRAM_BINARY_TYPE, cl_program_binary_type
70 root 1.3 cl_gl_texture_info, CL_GL_TEXTURE_TARGET, cl_GLenum
71     cl_gl_texture_info, CL_GL_MIPMAP_LEVEL, cl_GLint
72 root 1.4 cl_kernel_arg_info, CL_KERNEL_ARG_ADDRESS_QUALIFIER, cl_kernel_arg_address_qualifier
73     cl_kernel_arg_info, CL_KERNEL_ARG_ACCESS_QUALIFIER, cl_kernel_arg_access_qualifier
74     cl_kernel_arg_info, CL_KERNEL_ARG_TYPE_NAME, STRING_CLASS
75     cl_kernel_arg_info, CL_KERNEL_ARG_TYPE_QUALIFIER, cl_kernel_arg_type_qualifier
76     cl_kernel_arg_info, CL_KERNEL_ARG_NAME, STRING_CLASS
77 root 1.3 EOF
78 root 1.10 ) >getinfo.txt
79 root 1.1