ZTWHHH commited on
Commit
428e66c
·
verified ·
1 Parent(s): 53a04a4

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. vllm/lib/python3.10/site-packages/OpenGL/EGL/ANDROID/__init__.py +1 -0
  2. vllm/lib/python3.10/site-packages/OpenGL/EGL/ANDROID/__pycache__/recordable.cpython-310.pyc +0 -0
  3. vllm/lib/python3.10/site-packages/OpenGL/EGL/ANDROID/framebuffer_target.py +23 -0
  4. vllm/lib/python3.10/site-packages/OpenGL/EGL/ANDROID/image_native_buffer.py +23 -0
  5. vllm/lib/python3.10/site-packages/OpenGL/EGL/ANDROID/native_fence_sync.py +23 -0
  6. vllm/lib/python3.10/site-packages/OpenGL/EGL/ANDROID/recordable.py +23 -0
  7. vllm/lib/python3.10/site-packages/OpenGL/EGL/EXT/__pycache__/buffer_age.cpython-310.pyc +0 -0
  8. vllm/lib/python3.10/site-packages/OpenGL/EGL/EXT/__pycache__/client_extensions.cpython-310.pyc +0 -0
  9. vllm/lib/python3.10/site-packages/OpenGL/EGL/EXT/__pycache__/create_context_robustness.cpython-310.pyc +0 -0
  10. vllm/lib/python3.10/site-packages/OpenGL/EGL/EXT/__pycache__/multiview_window.cpython-310.pyc +0 -0
  11. vllm/lib/python3.10/site-packages/OpenGL/EGL/EXT/__pycache__/protected_surface.cpython-310.pyc +0 -0
  12. vllm/lib/python3.10/site-packages/OpenGL/EGL/EXT/__pycache__/swap_buffers_with_damage.cpython-310.pyc +0 -0
  13. vllm/lib/python3.10/site-packages/OpenGL/EGL/EXT/buffer_age.py +23 -0
  14. vllm/lib/python3.10/site-packages/OpenGL/EGL/EXT/client_extensions.py +23 -0
  15. vllm/lib/python3.10/site-packages/OpenGL/EGL/EXT/create_context_robustness.py +23 -0
  16. vllm/lib/python3.10/site-packages/OpenGL/EGL/EXT/image_dma_buf_import.py +23 -0
  17. vllm/lib/python3.10/site-packages/OpenGL/EGL/EXT/multiview_window.py +23 -0
  18. vllm/lib/python3.10/site-packages/OpenGL/EGL/EXT/platform_x11.py +23 -0
  19. vllm/lib/python3.10/site-packages/OpenGL/EGL/EXT/swap_buffers_with_damage.py +23 -0
  20. vllm/lib/python3.10/site-packages/OpenGL/EGL/VERSION/EGL_1_0.py +23 -0
  21. vllm/lib/python3.10/site-packages/OpenGL/EGL/VERSION/EGL_1_1.py +23 -0
  22. vllm/lib/python3.10/site-packages/OpenGL/EGL/VERSION/EGL_1_2.py +23 -0
  23. vllm/lib/python3.10/site-packages/OpenGL/EGL/VERSION/EGL_1_3.py +23 -0
  24. vllm/lib/python3.10/site-packages/OpenGL/EGL/VERSION/EGL_1_4.py +23 -0
  25. vllm/lib/python3.10/site-packages/OpenGL/EGL/VERSION/EGL_1_5.py +23 -0
  26. vllm/lib/python3.10/site-packages/OpenGL/EGL/VERSION/__init__.py +1 -0
  27. vllm/lib/python3.10/site-packages/OpenGL/EGL/VERSION/__pycache__/EGL_1_0.cpython-310.pyc +0 -0
  28. vllm/lib/python3.10/site-packages/OpenGL/EGL/VERSION/__pycache__/EGL_1_1.cpython-310.pyc +0 -0
  29. vllm/lib/python3.10/site-packages/OpenGL/EGL/VERSION/__pycache__/EGL_1_2.cpython-310.pyc +0 -0
  30. vllm/lib/python3.10/site-packages/OpenGL/EGL/VERSION/__pycache__/EGL_1_3.cpython-310.pyc +0 -0
  31. vllm/lib/python3.10/site-packages/OpenGL/EGL/VERSION/__pycache__/EGL_1_4.cpython-310.pyc +0 -0
  32. vllm/lib/python3.10/site-packages/OpenGL/EGL/VERSION/__pycache__/EGL_1_5.cpython-310.pyc +0 -0
  33. vllm/lib/python3.10/site-packages/OpenGL/EGL/VERSION/__pycache__/__init__.cpython-310.pyc +0 -0
  34. vllm/lib/python3.10/site-packages/OpenGL/EGL/__init__.py +8 -0
  35. vllm/lib/python3.10/site-packages/OpenGL/__init__.py +277 -0
  36. vllm/lib/python3.10/site-packages/OpenGL/_bytes.py +63 -0
  37. vllm/lib/python3.10/site-packages/OpenGL/_configflags.py +18 -0
  38. vllm/lib/python3.10/site-packages/OpenGL/_null.py +2 -0
  39. vllm/lib/python3.10/site-packages/OpenGL/_opaque.py +22 -0
  40. vllm/lib/python3.10/site-packages/OpenGL/acceleratesupport.py +18 -0
  41. vllm/lib/python3.10/site-packages/OpenGL/constant.py +78 -0
  42. vllm/lib/python3.10/site-packages/OpenGL/constants.py +3 -0
  43. vllm/lib/python3.10/site-packages/OpenGL/contextdata.py +132 -0
  44. vllm/lib/python3.10/site-packages/OpenGL/converters.py +316 -0
  45. vllm/lib/python3.10/site-packages/OpenGL/error.py +246 -0
  46. vllm/lib/python3.10/site-packages/OpenGL/extensions.py +256 -0
  47. vllm/lib/python3.10/site-packages/OpenGL/images.py +160 -0
  48. vllm/lib/python3.10/site-packages/OpenGL/latebind.py +61 -0
  49. vllm/lib/python3.10/site-packages/OpenGL/lazywrapper.py +58 -0
  50. vllm/lib/python3.10/site-packages/OpenGL/logs.py +91 -0
vllm/lib/python3.10/site-packages/OpenGL/EGL/ANDROID/__init__.py ADDED
@@ -0,0 +1 @@
 
 
1
+ """OpenGL Extensions"""
vllm/lib/python3.10/site-packages/OpenGL/EGL/ANDROID/__pycache__/recordable.cpython-310.pyc ADDED
Binary file (1 kB). View file
 
vllm/lib/python3.10/site-packages/OpenGL/EGL/ANDROID/framebuffer_target.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ '''OpenGL extension ANDROID.framebuffer_target
2
+
3
+ This module customises the behaviour of the
4
+ OpenGL.raw.EGL.ANDROID.framebuffer_target to provide a more
5
+ Python-friendly API
6
+
7
+ The official definition of this extension is available here:
8
+ http://www.opengl.org/registry/specs/ANDROID/framebuffer_target.txt
9
+ '''
10
+ from OpenGL import platform, constant, arrays
11
+ from OpenGL import extensions, wrapper
12
+ import ctypes
13
+ from OpenGL.raw.EGL import _types, _glgets
14
+ from OpenGL.raw.EGL.ANDROID.framebuffer_target import *
15
+ from OpenGL.raw.EGL.ANDROID.framebuffer_target import _EXTENSION_NAME
16
+
17
+ def glInitFramebufferTargetANDROID():
18
+ '''Return boolean indicating whether this extension is available'''
19
+ from OpenGL import extensions
20
+ return extensions.hasGLExtension( _EXTENSION_NAME )
21
+
22
+
23
+ ### END AUTOGENERATED SECTION
vllm/lib/python3.10/site-packages/OpenGL/EGL/ANDROID/image_native_buffer.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ '''OpenGL extension ANDROID.image_native_buffer
2
+
3
+ This module customises the behaviour of the
4
+ OpenGL.raw.EGL.ANDROID.image_native_buffer to provide a more
5
+ Python-friendly API
6
+
7
+ The official definition of this extension is available here:
8
+ http://www.opengl.org/registry/specs/ANDROID/image_native_buffer.txt
9
+ '''
10
+ from OpenGL import platform, constant, arrays
11
+ from OpenGL import extensions, wrapper
12
+ import ctypes
13
+ from OpenGL.raw.EGL import _types, _glgets
14
+ from OpenGL.raw.EGL.ANDROID.image_native_buffer import *
15
+ from OpenGL.raw.EGL.ANDROID.image_native_buffer import _EXTENSION_NAME
16
+
17
+ def glInitImageNativeBufferANDROID():
18
+ '''Return boolean indicating whether this extension is available'''
19
+ from OpenGL import extensions
20
+ return extensions.hasGLExtension( _EXTENSION_NAME )
21
+
22
+
23
+ ### END AUTOGENERATED SECTION
vllm/lib/python3.10/site-packages/OpenGL/EGL/ANDROID/native_fence_sync.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ '''OpenGL extension ANDROID.native_fence_sync
2
+
3
+ This module customises the behaviour of the
4
+ OpenGL.raw.EGL.ANDROID.native_fence_sync to provide a more
5
+ Python-friendly API
6
+
7
+ The official definition of this extension is available here:
8
+ http://www.opengl.org/registry/specs/ANDROID/native_fence_sync.txt
9
+ '''
10
+ from OpenGL import platform, constant, arrays
11
+ from OpenGL import extensions, wrapper
12
+ import ctypes
13
+ from OpenGL.raw.EGL import _types, _glgets
14
+ from OpenGL.raw.EGL.ANDROID.native_fence_sync import *
15
+ from OpenGL.raw.EGL.ANDROID.native_fence_sync import _EXTENSION_NAME
16
+
17
+ def glInitNativeFenceSyncANDROID():
18
+ '''Return boolean indicating whether this extension is available'''
19
+ from OpenGL import extensions
20
+ return extensions.hasGLExtension( _EXTENSION_NAME )
21
+
22
+
23
+ ### END AUTOGENERATED SECTION
vllm/lib/python3.10/site-packages/OpenGL/EGL/ANDROID/recordable.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ '''OpenGL extension ANDROID.recordable
2
+
3
+ This module customises the behaviour of the
4
+ OpenGL.raw.EGL.ANDROID.recordable to provide a more
5
+ Python-friendly API
6
+
7
+ The official definition of this extension is available here:
8
+ http://www.opengl.org/registry/specs/ANDROID/recordable.txt
9
+ '''
10
+ from OpenGL import platform, constant, arrays
11
+ from OpenGL import extensions, wrapper
12
+ import ctypes
13
+ from OpenGL.raw.EGL import _types, _glgets
14
+ from OpenGL.raw.EGL.ANDROID.recordable import *
15
+ from OpenGL.raw.EGL.ANDROID.recordable import _EXTENSION_NAME
16
+
17
+ def glInitRecordableANDROID():
18
+ '''Return boolean indicating whether this extension is available'''
19
+ from OpenGL import extensions
20
+ return extensions.hasGLExtension( _EXTENSION_NAME )
21
+
22
+
23
+ ### END AUTOGENERATED SECTION
vllm/lib/python3.10/site-packages/OpenGL/EGL/EXT/__pycache__/buffer_age.cpython-310.pyc ADDED
Binary file (977 Bytes). View file
 
vllm/lib/python3.10/site-packages/OpenGL/EGL/EXT/__pycache__/client_extensions.cpython-310.pyc ADDED
Binary file (1.02 kB). View file
 
vllm/lib/python3.10/site-packages/OpenGL/EGL/EXT/__pycache__/create_context_robustness.cpython-310.pyc ADDED
Binary file (1.07 kB). View file
 
vllm/lib/python3.10/site-packages/OpenGL/EGL/EXT/__pycache__/multiview_window.cpython-310.pyc ADDED
Binary file (1.01 kB). View file
 
vllm/lib/python3.10/site-packages/OpenGL/EGL/EXT/__pycache__/protected_surface.cpython-310.pyc ADDED
Binary file (1.02 kB). View file
 
vllm/lib/python3.10/site-packages/OpenGL/EGL/EXT/__pycache__/swap_buffers_with_damage.cpython-310.pyc ADDED
Binary file (1.06 kB). View file
 
vllm/lib/python3.10/site-packages/OpenGL/EGL/EXT/buffer_age.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ '''OpenGL extension EXT.buffer_age
2
+
3
+ This module customises the behaviour of the
4
+ OpenGL.raw.EGL.EXT.buffer_age to provide a more
5
+ Python-friendly API
6
+
7
+ The official definition of this extension is available here:
8
+ http://www.opengl.org/registry/specs/EXT/buffer_age.txt
9
+ '''
10
+ from OpenGL import platform, constant, arrays
11
+ from OpenGL import extensions, wrapper
12
+ import ctypes
13
+ from OpenGL.raw.EGL import _types, _glgets
14
+ from OpenGL.raw.EGL.EXT.buffer_age import *
15
+ from OpenGL.raw.EGL.EXT.buffer_age import _EXTENSION_NAME
16
+
17
+ def glInitBufferAgeEXT():
18
+ '''Return boolean indicating whether this extension is available'''
19
+ from OpenGL import extensions
20
+ return extensions.hasGLExtension( _EXTENSION_NAME )
21
+
22
+
23
+ ### END AUTOGENERATED SECTION
vllm/lib/python3.10/site-packages/OpenGL/EGL/EXT/client_extensions.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ '''OpenGL extension EXT.client_extensions
2
+
3
+ This module customises the behaviour of the
4
+ OpenGL.raw.EGL.EXT.client_extensions to provide a more
5
+ Python-friendly API
6
+
7
+ The official definition of this extension is available here:
8
+ http://www.opengl.org/registry/specs/EXT/client_extensions.txt
9
+ '''
10
+ from OpenGL import platform, constant, arrays
11
+ from OpenGL import extensions, wrapper
12
+ import ctypes
13
+ from OpenGL.raw.EGL import _types, _glgets
14
+ from OpenGL.raw.EGL.EXT.client_extensions import *
15
+ from OpenGL.raw.EGL.EXT.client_extensions import _EXTENSION_NAME
16
+
17
+ def glInitClientExtensionsEXT():
18
+ '''Return boolean indicating whether this extension is available'''
19
+ from OpenGL import extensions
20
+ return extensions.hasGLExtension( _EXTENSION_NAME )
21
+
22
+
23
+ ### END AUTOGENERATED SECTION
vllm/lib/python3.10/site-packages/OpenGL/EGL/EXT/create_context_robustness.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ '''OpenGL extension EXT.create_context_robustness
2
+
3
+ This module customises the behaviour of the
4
+ OpenGL.raw.EGL.EXT.create_context_robustness to provide a more
5
+ Python-friendly API
6
+
7
+ The official definition of this extension is available here:
8
+ http://www.opengl.org/registry/specs/EXT/create_context_robustness.txt
9
+ '''
10
+ from OpenGL import platform, constant, arrays
11
+ from OpenGL import extensions, wrapper
12
+ import ctypes
13
+ from OpenGL.raw.EGL import _types, _glgets
14
+ from OpenGL.raw.EGL.EXT.create_context_robustness import *
15
+ from OpenGL.raw.EGL.EXT.create_context_robustness import _EXTENSION_NAME
16
+
17
+ def glInitCreateContextRobustnessEXT():
18
+ '''Return boolean indicating whether this extension is available'''
19
+ from OpenGL import extensions
20
+ return extensions.hasGLExtension( _EXTENSION_NAME )
21
+
22
+
23
+ ### END AUTOGENERATED SECTION
vllm/lib/python3.10/site-packages/OpenGL/EGL/EXT/image_dma_buf_import.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ '''OpenGL extension EXT.image_dma_buf_import
2
+
3
+ This module customises the behaviour of the
4
+ OpenGL.raw.EGL.EXT.image_dma_buf_import to provide a more
5
+ Python-friendly API
6
+
7
+ The official definition of this extension is available here:
8
+ http://www.opengl.org/registry/specs/EXT/image_dma_buf_import.txt
9
+ '''
10
+ from OpenGL import platform, constant, arrays
11
+ from OpenGL import extensions, wrapper
12
+ import ctypes
13
+ from OpenGL.raw.EGL import _types, _glgets
14
+ from OpenGL.raw.EGL.EXT.image_dma_buf_import import *
15
+ from OpenGL.raw.EGL.EXT.image_dma_buf_import import _EXTENSION_NAME
16
+
17
+ def glInitImageDmaBufImportEXT():
18
+ '''Return boolean indicating whether this extension is available'''
19
+ from OpenGL import extensions
20
+ return extensions.hasGLExtension( _EXTENSION_NAME )
21
+
22
+
23
+ ### END AUTOGENERATED SECTION
vllm/lib/python3.10/site-packages/OpenGL/EGL/EXT/multiview_window.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ '''OpenGL extension EXT.multiview_window
2
+
3
+ This module customises the behaviour of the
4
+ OpenGL.raw.EGL.EXT.multiview_window to provide a more
5
+ Python-friendly API
6
+
7
+ The official definition of this extension is available here:
8
+ http://www.opengl.org/registry/specs/EXT/multiview_window.txt
9
+ '''
10
+ from OpenGL import platform, constant, arrays
11
+ from OpenGL import extensions, wrapper
12
+ import ctypes
13
+ from OpenGL.raw.EGL import _types, _glgets
14
+ from OpenGL.raw.EGL.EXT.multiview_window import *
15
+ from OpenGL.raw.EGL.EXT.multiview_window import _EXTENSION_NAME
16
+
17
+ def glInitMultiviewWindowEXT():
18
+ '''Return boolean indicating whether this extension is available'''
19
+ from OpenGL import extensions
20
+ return extensions.hasGLExtension( _EXTENSION_NAME )
21
+
22
+
23
+ ### END AUTOGENERATED SECTION
vllm/lib/python3.10/site-packages/OpenGL/EGL/EXT/platform_x11.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ '''OpenGL extension EXT.platform_x11
2
+
3
+ This module customises the behaviour of the
4
+ OpenGL.raw.EGL.EXT.platform_x11 to provide a more
5
+ Python-friendly API
6
+
7
+ The official definition of this extension is available here:
8
+ http://www.opengl.org/registry/specs/EXT/platform_x11.txt
9
+ '''
10
+ from OpenGL import platform, constant, arrays
11
+ from OpenGL import extensions, wrapper
12
+ import ctypes
13
+ from OpenGL.raw.EGL import _types, _glgets
14
+ from OpenGL.raw.EGL.EXT.platform_x11 import *
15
+ from OpenGL.raw.EGL.EXT.platform_x11 import _EXTENSION_NAME
16
+
17
+ def glInitPlatformX11EXT():
18
+ '''Return boolean indicating whether this extension is available'''
19
+ from OpenGL import extensions
20
+ return extensions.hasGLExtension( _EXTENSION_NAME )
21
+
22
+
23
+ ### END AUTOGENERATED SECTION
vllm/lib/python3.10/site-packages/OpenGL/EGL/EXT/swap_buffers_with_damage.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ '''OpenGL extension EXT.swap_buffers_with_damage
2
+
3
+ This module customises the behaviour of the
4
+ OpenGL.raw.EGL.EXT.swap_buffers_with_damage to provide a more
5
+ Python-friendly API
6
+
7
+ The official definition of this extension is available here:
8
+ http://www.opengl.org/registry/specs/EXT/swap_buffers_with_damage.txt
9
+ '''
10
+ from OpenGL import platform, constant, arrays
11
+ from OpenGL import extensions, wrapper
12
+ import ctypes
13
+ from OpenGL.raw.EGL import _types, _glgets
14
+ from OpenGL.raw.EGL.EXT.swap_buffers_with_damage import *
15
+ from OpenGL.raw.EGL.EXT.swap_buffers_with_damage import _EXTENSION_NAME
16
+
17
+ def glInitSwapBuffersWithDamageEXT():
18
+ '''Return boolean indicating whether this extension is available'''
19
+ from OpenGL import extensions
20
+ return extensions.hasGLExtension( _EXTENSION_NAME )
21
+
22
+
23
+ ### END AUTOGENERATED SECTION
vllm/lib/python3.10/site-packages/OpenGL/EGL/VERSION/EGL_1_0.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ '''OpenGL extension VERSION.EGL_1_0
2
+
3
+ This module customises the behaviour of the
4
+ OpenGL.raw.EGL.VERSION.EGL_1_0 to provide a more
5
+ Python-friendly API
6
+
7
+ The official definition of this extension is available here:
8
+ http://www.opengl.org/registry/specs/VERSION/EGL_1_0.txt
9
+ '''
10
+ from OpenGL import platform, constant, arrays
11
+ from OpenGL import extensions, wrapper
12
+ import ctypes
13
+ from OpenGL.raw.EGL import _types, _glgets
14
+ from OpenGL.raw.EGL.VERSION.EGL_1_0 import *
15
+ from OpenGL.raw.EGL.VERSION.EGL_1_0 import _EXTENSION_NAME
16
+
17
+ def glInitEgl10VERSION():
18
+ '''Return boolean indicating whether this extension is available'''
19
+ from OpenGL import extensions
20
+ return extensions.hasGLExtension( _EXTENSION_NAME )
21
+
22
+
23
+ ### END AUTOGENERATED SECTION
vllm/lib/python3.10/site-packages/OpenGL/EGL/VERSION/EGL_1_1.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ '''OpenGL extension VERSION.EGL_1_1
2
+
3
+ This module customises the behaviour of the
4
+ OpenGL.raw.EGL.VERSION.EGL_1_1 to provide a more
5
+ Python-friendly API
6
+
7
+ The official definition of this extension is available here:
8
+ http://www.opengl.org/registry/specs/VERSION/EGL_1_1.txt
9
+ '''
10
+ from OpenGL import platform, constant, arrays
11
+ from OpenGL import extensions, wrapper
12
+ import ctypes
13
+ from OpenGL.raw.EGL import _types, _glgets
14
+ from OpenGL.raw.EGL.VERSION.EGL_1_1 import *
15
+ from OpenGL.raw.EGL.VERSION.EGL_1_1 import _EXTENSION_NAME
16
+
17
+ def glInitEgl11VERSION():
18
+ '''Return boolean indicating whether this extension is available'''
19
+ from OpenGL import extensions
20
+ return extensions.hasGLExtension( _EXTENSION_NAME )
21
+
22
+
23
+ ### END AUTOGENERATED SECTION
vllm/lib/python3.10/site-packages/OpenGL/EGL/VERSION/EGL_1_2.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ '''OpenGL extension VERSION.EGL_1_2
2
+
3
+ This module customises the behaviour of the
4
+ OpenGL.raw.EGL.VERSION.EGL_1_2 to provide a more
5
+ Python-friendly API
6
+
7
+ The official definition of this extension is available here:
8
+ http://www.opengl.org/registry/specs/VERSION/EGL_1_2.txt
9
+ '''
10
+ from OpenGL import platform, constant, arrays
11
+ from OpenGL import extensions, wrapper
12
+ import ctypes
13
+ from OpenGL.raw.EGL import _types, _glgets
14
+ from OpenGL.raw.EGL.VERSION.EGL_1_2 import *
15
+ from OpenGL.raw.EGL.VERSION.EGL_1_2 import _EXTENSION_NAME
16
+
17
+ def glInitEgl12VERSION():
18
+ '''Return boolean indicating whether this extension is available'''
19
+ from OpenGL import extensions
20
+ return extensions.hasGLExtension( _EXTENSION_NAME )
21
+
22
+
23
+ ### END AUTOGENERATED SECTION
vllm/lib/python3.10/site-packages/OpenGL/EGL/VERSION/EGL_1_3.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ '''OpenGL extension VERSION.EGL_1_3
2
+
3
+ This module customises the behaviour of the
4
+ OpenGL.raw.EGL.VERSION.EGL_1_3 to provide a more
5
+ Python-friendly API
6
+
7
+ The official definition of this extension is available here:
8
+ http://www.opengl.org/registry/specs/VERSION/EGL_1_3.txt
9
+ '''
10
+ from OpenGL import platform, constant, arrays
11
+ from OpenGL import extensions, wrapper
12
+ import ctypes
13
+ from OpenGL.raw.EGL import _types, _glgets
14
+ from OpenGL.raw.EGL.VERSION.EGL_1_3 import *
15
+ from OpenGL.raw.EGL.VERSION.EGL_1_3 import _EXTENSION_NAME
16
+
17
+ def glInitEgl13VERSION():
18
+ '''Return boolean indicating whether this extension is available'''
19
+ from OpenGL import extensions
20
+ return extensions.hasGLExtension( _EXTENSION_NAME )
21
+
22
+
23
+ ### END AUTOGENERATED SECTION
vllm/lib/python3.10/site-packages/OpenGL/EGL/VERSION/EGL_1_4.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ '''OpenGL extension VERSION.EGL_1_4
2
+
3
+ This module customises the behaviour of the
4
+ OpenGL.raw.EGL.VERSION.EGL_1_4 to provide a more
5
+ Python-friendly API
6
+
7
+ The official definition of this extension is available here:
8
+ http://www.opengl.org/registry/specs/VERSION/EGL_1_4.txt
9
+ '''
10
+ from OpenGL import platform, constant, arrays
11
+ from OpenGL import extensions, wrapper
12
+ import ctypes
13
+ from OpenGL.raw.EGL import _types, _glgets
14
+ from OpenGL.raw.EGL.VERSION.EGL_1_4 import *
15
+ from OpenGL.raw.EGL.VERSION.EGL_1_4 import _EXTENSION_NAME
16
+
17
+ def glInitEgl14VERSION():
18
+ '''Return boolean indicating whether this extension is available'''
19
+ from OpenGL import extensions
20
+ return extensions.hasGLExtension( _EXTENSION_NAME )
21
+
22
+
23
+ ### END AUTOGENERATED SECTION
vllm/lib/python3.10/site-packages/OpenGL/EGL/VERSION/EGL_1_5.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ '''OpenGL extension VERSION.EGL_1_5
2
+
3
+ This module customises the behaviour of the
4
+ OpenGL.raw.EGL.VERSION.EGL_1_5 to provide a more
5
+ Python-friendly API
6
+
7
+ The official definition of this extension is available here:
8
+ http://www.opengl.org/registry/specs/VERSION/EGL_1_5.txt
9
+ '''
10
+ from OpenGL import platform, constant, arrays
11
+ from OpenGL import extensions, wrapper
12
+ import ctypes
13
+ from OpenGL.raw.EGL import _types, _glgets
14
+ from OpenGL.raw.EGL.VERSION.EGL_1_5 import *
15
+ from OpenGL.raw.EGL.VERSION.EGL_1_5 import _EXTENSION_NAME
16
+
17
+ def glInitEgl15VERSION():
18
+ '''Return boolean indicating whether this extension is available'''
19
+ from OpenGL import extensions
20
+ return extensions.hasGLExtension( _EXTENSION_NAME )
21
+
22
+
23
+ ### END AUTOGENERATED SECTION
vllm/lib/python3.10/site-packages/OpenGL/EGL/VERSION/__init__.py ADDED
@@ -0,0 +1 @@
 
 
1
+ """OpenGL Extensions"""
vllm/lib/python3.10/site-packages/OpenGL/EGL/VERSION/__pycache__/EGL_1_0.cpython-310.pyc ADDED
Binary file (982 Bytes). View file
 
vllm/lib/python3.10/site-packages/OpenGL/EGL/VERSION/__pycache__/EGL_1_1.cpython-310.pyc ADDED
Binary file (982 Bytes). View file
 
vllm/lib/python3.10/site-packages/OpenGL/EGL/VERSION/__pycache__/EGL_1_2.cpython-310.pyc ADDED
Binary file (982 Bytes). View file
 
vllm/lib/python3.10/site-packages/OpenGL/EGL/VERSION/__pycache__/EGL_1_3.cpython-310.pyc ADDED
Binary file (982 Bytes). View file
 
vllm/lib/python3.10/site-packages/OpenGL/EGL/VERSION/__pycache__/EGL_1_4.cpython-310.pyc ADDED
Binary file (982 Bytes). View file
 
vllm/lib/python3.10/site-packages/OpenGL/EGL/VERSION/__pycache__/EGL_1_5.cpython-310.pyc ADDED
Binary file (982 Bytes). View file
 
vllm/lib/python3.10/site-packages/OpenGL/EGL/VERSION/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (197 Bytes). View file
 
vllm/lib/python3.10/site-packages/OpenGL/EGL/__init__.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ """OpenGL.EGL the portable interface to GL environments"""
2
+ from OpenGL.raw.EGL._types import *
3
+ from OpenGL.EGL.VERSION.EGL_1_0 import *
4
+ from OpenGL.EGL.VERSION.EGL_1_1 import *
5
+ from OpenGL.EGL.VERSION.EGL_1_2 import *
6
+ from OpenGL.EGL.VERSION.EGL_1_3 import *
7
+ from OpenGL.EGL.VERSION.EGL_1_4 import *
8
+ from OpenGL.EGL.VERSION.EGL_1_5 import *
vllm/lib/python3.10/site-packages/OpenGL/__init__.py ADDED
@@ -0,0 +1,277 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """ctypes-based OpenGL wrapper for Python
2
+
3
+ This is the PyOpenGL 3.x tree, it attempts to provide
4
+ a largely compatible API for code written with the
5
+ PyOpenGL 2.x series using the ctypes foreign function
6
+ interface system.
7
+
8
+ Configuration Variables:
9
+
10
+ There are a few configuration variables in this top-level
11
+ module. Applications should be the only code that tweaks
12
+ these variables, mid-level libraries should not take it
13
+ upon themselves to disable/enable features at this level.
14
+ The implication there is that your library code should be
15
+ able to work with any of the valid configurations available
16
+ with these sets of flags.
17
+
18
+ Further, once any entry point has been loaded, the variables
19
+ can no longer be updated. The OpenGL._confligflags module
20
+ imports the variables from this location, and once that
21
+ import occurs the flags should no longer be changed.
22
+
23
+ ERROR_CHECKING -- if set to a False value before
24
+ importing any OpenGL.* libraries will completely
25
+ disable error-checking. This can dramatically
26
+ improve performance, but makes debugging far
27
+ harder.
28
+
29
+ This is intended to be turned off *only* in a
30
+ production environment where you *know* that
31
+ your code is entirely free of situations where you
32
+ use exception-handling to handle error conditions,
33
+ i.e. where you are explicitly checking for errors
34
+ everywhere they can occur in your code.
35
+
36
+ Default: True
37
+
38
+ ERROR_LOGGING -- If True, then wrap array-handler
39
+ functions with error-logging operations so that all exceptions
40
+ will be reported to log objects in OpenGL.logs, note that
41
+ this means you will get lots of error logging whenever you
42
+ have code that tests by trying something and catching an
43
+ error, this is intended to be turned on only during
44
+ development so that you can see why something is failing.
45
+
46
+ Errors are normally logged to the OpenGL.errors logger.
47
+
48
+ Only triggers if ERROR_CHECKING is True
49
+
50
+ Default: False
51
+
52
+ ERROR_ON_COPY -- if set to a True value before
53
+ importing the numpy/lists support modules, will
54
+ cause array operations to raise
55
+ OpenGL.error.CopyError if the operation
56
+ would cause a data-copy in order to make the
57
+ passed data-type match the target data-type.
58
+
59
+ This effectively disables all list/tuple array
60
+ support, as they are inherently copy-based.
61
+
62
+ This feature allows for optimisation of your
63
+ application. It should only be enabled during
64
+ testing stages to prevent raising errors on
65
+ recoverable conditions at run-time.
66
+
67
+ Default: False
68
+
69
+ CONTEXT_CHECKING -- if set to True, PyOpenGL will wrap
70
+ *every* GL and GLU call with a check to see if there
71
+ is a valid context. If there is no valid context
72
+ then will throw OpenGL.errors.NoContext. This is an
73
+ *extremely* slow check and is not enabled by default,
74
+ intended to be enabled in order to track down (wrong)
75
+ code that uses GL/GLU entry points before the context
76
+ has been initialized (something later Linux GLs are
77
+ very picky about).
78
+
79
+ Default: False
80
+
81
+ STORE_POINTERS -- if set to True, PyOpenGL array operations
82
+ will attempt to store references to pointers which are
83
+ being passed in order to prevent memory-access failures
84
+ if the pointed-to-object goes out of scope. This
85
+ behaviour is primarily intended to allow temporary arrays
86
+ to be created without causing memory errors, thus it is
87
+ trading off performance for safety.
88
+
89
+ To use this flag effectively, you will want to first set
90
+ ERROR_ON_COPY to True and eliminate all cases where you
91
+ are copying arrays. Copied arrays *will* segfault your
92
+ application deep within the GL if you disable this feature!
93
+
94
+ Once you have eliminated all copying of arrays in your
95
+ application, you will further need to be sure that all
96
+ arrays which are passed to the GL are stored for at least
97
+ the time period for which they are active in the GL. That
98
+ is, you must be sure that your array objects live at least
99
+ until they are no longer bound in the GL. This is something
100
+ you need to confirm by thinking about your application's
101
+ structure.
102
+
103
+ When you are sure your arrays won't cause seg-faults, you
104
+ can set STORE_POINTERS=False in your application and enjoy
105
+ a (slight) speed up.
106
+
107
+ Note: this flag is *only* observed when ERROR_ON_COPY == True,
108
+ as a safety measure to prevent pointless segfaults
109
+
110
+ Default: True
111
+
112
+ WARN_ON_FORMAT_UNAVAILABLE -- If True, generates
113
+ logging-module warn-level events when a FormatHandler
114
+ plugin is not loadable (with traceback).
115
+
116
+ Default: False
117
+
118
+ FULL_LOGGING -- If True, then wrap functions with
119
+ logging operations which reports each call along with its
120
+ arguments to the OpenGL.calltrace logger at the INFO
121
+ level. This is *extremely* slow. You should *not* enable
122
+ this in production code!
123
+
124
+ You will need to have a logging configuration (e.g.
125
+ logging.basicConfig()
126
+ ) call in your top-level script to see the results of the
127
+ logging.
128
+
129
+ Default: False
130
+
131
+ ALLOW_NUMPY_SCALARS -- if True, we will wrap
132
+ all GLint/GLfloat calls conversions with wrappers
133
+ that allow for passing numpy scalar values.
134
+
135
+ Note that this is experimental, *not* reliable,
136
+ and very slow!
137
+
138
+ Note that byte/char types are not wrapped.
139
+
140
+ Default: False
141
+
142
+ UNSIGNED_BYTE_IMAGES_AS_STRING -- if True, we will return
143
+ GL_UNSIGNED_BYTE image-data as strings, instead of arrays
144
+ for glReadPixels and glGetTexImage
145
+
146
+ Default: True
147
+
148
+ FORWARD_COMPATIBLE_ONLY -- only include OpenGL 3.1 compatible
149
+ entry points. Note that this will generally break most
150
+ PyOpenGL code that hasn't been explicitly made "legacy free"
151
+ via a significant rewrite.
152
+
153
+ Default: False
154
+
155
+ SIZE_1_ARRAY_UNPACK -- if True, unpack size-1 arrays to be
156
+ scalar values, as done in PyOpenGL 1.5 -> 3.0.0, that is,
157
+ if a glGenList( 1 ) is done, return a uint rather than
158
+ an array of uints.
159
+
160
+ Default: True
161
+
162
+ USE_ACCELERATE -- if True, attempt to use the OpenGL_accelerate
163
+ package to provide Cython-coded accelerators for core wrapping
164
+ operations.
165
+
166
+ Default: True
167
+
168
+ MODULE_ANNOTATIONS -- if True, attempt to annotate alternates() and
169
+ constants to track in which module they are defined (only useful
170
+ for the documentation-generation passes, really).
171
+
172
+ Default: False
173
+ """
174
+ from OpenGL.version import __version__
175
+ import os
176
+ def environ_key( name, default ):
177
+ composed = 'PYOPENGL_%s'%name.upper()
178
+ if composed in os.environ:
179
+ value = os.environ[composed]
180
+ if value.lower() in ('1','true'):
181
+ return True
182
+ else:
183
+ return False
184
+ return os.environ.get( composed, default )
185
+
186
+ ERROR_CHECKING = environ_key( 'ERROR_CHECKING', True)
187
+ ERROR_LOGGING = environ_key( 'ERROR_LOGGING', False )
188
+ ERROR_ON_COPY = environ_key( 'ERROR_ON_COPY', False )
189
+ ARRAY_SIZE_CHECKING = environ_key( 'ARRAY_SIZE_CHECKING', True )
190
+ STORE_POINTERS = environ_key( 'STORE_POINTERS', True )
191
+ WARN_ON_FORMAT_UNAVAILABLE = False
192
+ FORWARD_COMPATIBLE_ONLY = False
193
+ SIZE_1_ARRAY_UNPACK = True
194
+ USE_ACCELERATE = environ_key( 'USE_ACCELERATE', True )
195
+ CONTEXT_CHECKING = environ_key( 'CONTEXT_CHECKING', False )
196
+
197
+ FULL_LOGGING = environ_key( 'FULL_LOGGING', False )
198
+ ALLOW_NUMPY_SCALARS = environ_key( 'ALLOW_NUMPY_SCALARS', False )
199
+ UNSIGNED_BYTE_IMAGES_AS_STRING = environ_key( 'UNSIGNED_BYTE_IMAGES_AS_STRING', True )
200
+ MODULE_ANNOTATIONS = False
201
+
202
+ # Declarations of plugins provided by PyOpenGL itself
203
+ from OpenGL.plugins import PlatformPlugin, FormatHandler
204
+ PlatformPlugin( 'nt', 'OpenGL.platform.win32.Win32Platform' )
205
+ PlatformPlugin( 'linux2', 'OpenGL.platform.glx.GLXPlatform' )
206
+ PlatformPlugin( 'darwin', 'OpenGL.platform.darwin.DarwinPlatform' )
207
+ PlatformPlugin( 'posix', 'OpenGL.platform.glx.GLXPlatform' )
208
+ PlatformPlugin( 'osmesa', 'OpenGL.platform.osmesa.OSMesaPlatform')
209
+ PlatformPlugin( 'egl', 'OpenGL.platform.egl.EGLPlatform')
210
+
211
+ import sys
212
+ if sys.version_info[0] < 3:
213
+ # Python 3.x renames the built-in module
214
+ _bi = '__builtin__'
215
+ else:
216
+ _bi = 'builtins'
217
+
218
+ FormatHandler( 'none', 'OpenGL.arrays.nones.NoneHandler', [ _bi+'.NoneType'],isOutput=False )
219
+
220
+ if sys.version_info[0] < 3:
221
+ FormatHandler( 'str', 'OpenGL.arrays.strings.StringHandler',[_bi+'.str'], isOutput=False )
222
+ FormatHandler( 'unicode', 'OpenGL.arrays.strings.UnicodeHandler',[_bi+'.unicode'], isOutput=False )
223
+ else:
224
+ FormatHandler( 'bytes', 'OpenGL.arrays.strings.StringHandler',[_bi+'.bytes'], isOutput=False )
225
+ FormatHandler( 'str', 'OpenGL.arrays.strings.UnicodeHandler',[_bi+'.str'], isOutput=False )
226
+
227
+ FormatHandler( 'list', 'OpenGL.arrays.lists.ListHandler', [
228
+ _bi+'.list',
229
+ _bi+'.tuple',
230
+ ], isOutput=False )
231
+ FormatHandler( 'numbers', 'OpenGL.arrays.numbers.NumberHandler', [
232
+ _bi+'.int',
233
+ _bi+'.float',
234
+ _bi+'.long',
235
+ ], isOutput=False )
236
+ FormatHandler(
237
+ 'ctypesarrays', 'OpenGL.arrays.ctypesarrays.CtypesArrayHandler',
238
+ [
239
+ '_ctypes.ArrayType',
240
+ '_ctypes.PyCArrayType',
241
+ '_ctypes.Array',
242
+ '_ctypes.array.Array',
243
+ ],
244
+ isOutput=True,
245
+ )
246
+ FormatHandler(
247
+ 'ctypesparameter',
248
+ 'OpenGL.arrays.ctypesparameters.CtypesParameterHandler',
249
+ [
250
+ _bi+'.CArgObject',
251
+ 'ctypes.c_uint',
252
+ 'ctypes.c_int',
253
+ 'ctypes.c_float',
254
+ 'ctypes.c_double',
255
+ 'ctypes.c_ulong',
256
+ 'ctypes.c_long',
257
+ 'ctypes.c_longlong',
258
+ ],
259
+ isOutput=True,
260
+ )
261
+ FormatHandler( 'ctypespointer', 'OpenGL.arrays.ctypespointers.CtypesPointerHandler',[
262
+ 'ctypes.c_void_p',
263
+ '_ctypes._Pointer',
264
+ 'ctypes.c_char_p',
265
+ '_ctypes.pointer._Pointer',
266
+ ],isOutput=False )
267
+ FormatHandler( 'numpy', 'OpenGL.arrays.numpymodule.NumpyHandler', [
268
+ 'numpy.ndarray',
269
+ 'numpy.core.memmap.memmap',
270
+ ],isOutput=True )
271
+ FormatHandler( 'buffer', 'OpenGL.arrays.buffers.BufferHandler', [
272
+ 'OpenGL.arrays._buffers.Py_buffer',
273
+ _bi+'.memoryview',
274
+ _bi+'.bytearray',
275
+ ],isOutput=True )
276
+ FormatHandler( 'vbo', 'OpenGL.arrays.vbo.VBOHandler', ['OpenGL.arrays.vbo.VBO','OpenGL_accelerate.vbo.VBO'],isOutput=False )
277
+ FormatHandler( 'vbooffset', 'OpenGL.arrays.vbo.VBOOffsetHandler', ['OpenGL.arrays.vbo.VBOOffset','OpenGL_accelerate.vbo.VBOOffset'],isOutput=False )
vllm/lib/python3.10/site-packages/OpenGL/_bytes.py ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """8-bit string definitions for Python 2/3 compatibility
2
+
3
+ Defines the following which allow for dealing with Python 3 breakages:
4
+
5
+ STR_IS_BYTES
6
+ STR_IS_UNICODE
7
+
8
+ Easily checked booleans for type identities
9
+
10
+ _NULL_8_BYTE
11
+
12
+ An 8-bit byte with NULL (0) value
13
+
14
+ as_8_bit( x, encoding='utf-8')
15
+
16
+ Returns the value as the 8-bit version
17
+
18
+ unicode -- always pointing to the unicode type
19
+ bytes -- always pointing to the 8-bit bytes type
20
+ """
21
+ import sys
22
+
23
+ STR_IS_BYTES = True
24
+
25
+ if sys.version_info[:2] < (2,6):
26
+ # no bytes, traditional setup...
27
+ bytes = str
28
+ else:
29
+ bytes = bytes
30
+ try:
31
+ long = long
32
+ except NameError as err:
33
+ long = int
34
+ if sys.version_info[:2] < (3,0):
35
+ # traditional setup, with bytes defined...
36
+ unicode = unicode
37
+ _NULL_8_BYTE = '\000'
38
+ def as_8_bit( x, encoding='utf-8' ):
39
+ if isinstance( x, unicode ):
40
+ return x.encode( encoding )
41
+ return bytes( x )
42
+ integer_types = int,long
43
+ else:
44
+ # new setup, str is now unicode...
45
+ STR_IS_BYTES = False
46
+ _NULL_8_BYTE = bytes( '\000','latin1' )
47
+ def as_8_bit( x, encoding='utf-8' ):
48
+ if isinstance( x,unicode ):
49
+ return x.encode(encoding)
50
+ elif isinstance( x, bytes ):
51
+ # Note: this can create an 8-bit string that is *not* in encoding,
52
+ # but that is potentially exactly what we wanted, as these can
53
+ # be arbitrary byte-streams being passed to C functions
54
+ return x
55
+ return str(x).encode( encoding )
56
+ unicode = str
57
+ integer_types = int,
58
+
59
+ STR_IS_UNICODE = not STR_IS_BYTES
60
+ if hasattr( sys, 'maxsize' ):
61
+ maxsize = sys.maxsize
62
+ else:
63
+ maxsize = sys.maxint
vllm/lib/python3.10/site-packages/OpenGL/_configflags.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Holds the import-time constants for various configuration flags"""
2
+ from OpenGL import (
3
+ ERROR_CHECKING,
4
+ ERROR_LOGGING,
5
+ ERROR_ON_COPY,
6
+ ARRAY_SIZE_CHECKING,
7
+ STORE_POINTERS,
8
+ WARN_ON_FORMAT_UNAVAILABLE,
9
+ FORWARD_COMPATIBLE_ONLY,
10
+ SIZE_1_ARRAY_UNPACK,
11
+ USE_ACCELERATE,
12
+ CONTEXT_CHECKING,
13
+
14
+ FULL_LOGGING,
15
+ ALLOW_NUMPY_SCALARS,
16
+ UNSIGNED_BYTE_IMAGES_AS_STRING,
17
+ MODULE_ANNOTATIONS,
18
+ )
vllm/lib/python3.10/site-packages/OpenGL/_null.py ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ """Just a NULL object for reference by other modules"""
2
+ NULL = object()
vllm/lib/python3.10/site-packages/OpenGL/_opaque.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Data-type definitions for EGL/GLES"""
2
+ import ctypes
3
+ pointer = ctypes.pointer
4
+
5
+ class _Opaque( ctypes.Structure ):
6
+ """An Opaque Structure reference (base class)"""
7
+ class _opaque_pointer( ctypes.POINTER( _Opaque ) ):
8
+ _type_ = _Opaque
9
+ @classmethod
10
+ def from_param( cls, value ):
11
+ return ctypes.cast( value, cls )
12
+ @property
13
+ def address( self ):
14
+ return ctypes.addressof( self.contents )
15
+ @property
16
+ def as_voidp( self ):
17
+ return ctypes.c_voidp( self.address )
18
+ def opaque_pointer_cls( name ):
19
+ """Create an Opaque pointer class for the given name"""
20
+ typ = type( name, (_Opaque,), {} )
21
+ p_typ = type( name+'_pointer', (_opaque_pointer,), {'_type_':typ})
22
+ return p_typ
vllm/lib/python3.10/site-packages/OpenGL/acceleratesupport.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Common code for accelerated modules"""
2
+ import logging
3
+ from OpenGL import _configflags
4
+ needed_version = (3,1,0)
5
+ _log = logging.getLogger( 'OpenGL.acceleratesupport' )
6
+ try:
7
+ import OpenGL_accelerate
8
+ if _configflags.USE_ACCELERATE:
9
+ if OpenGL_accelerate.__version_tuple__ < needed_version:
10
+ _log.warn( """Incompatible version of OpenGL_accelerate found, need at least %s found %s""", needed_version, OpenGL_accelerate.__version_tuple__)
11
+ raise ImportError( """Old version of OpenGL_accelerate""" )
12
+ ACCELERATE_AVAILABLE = True
13
+ _log.info( """OpenGL_accelerate module loaded""" )
14
+ else:
15
+ raise ImportError( """Acceleration disabled""" )
16
+ except ImportError as err:
17
+ _log.info( """No OpenGL_accelerate module loaded: %s""", err )
18
+ ACCELERATE_AVAILABLE = False
vllm/lib/python3.10/site-packages/OpenGL/constant.py ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Implementation of OpenGL constant objects"""
2
+ import sys
3
+ from OpenGL._bytes import bytes,unicode,as_8_bit, long, integer_types, maxsize
4
+ from OpenGL import _configflags
5
+
6
+ class Constant( object ):
7
+ """OpenGL constant that displays itself as a name rather than a value
8
+
9
+ The purpose of this class is to make debugging OpenGL code easier,
10
+ as you recieve messages that say what value you passed in in a
11
+ human-readable form, rather than as a bald number that requires
12
+ lookup and disambiguation in the header file.
13
+ """
14
+ def __new__( cls, name, value=None ):
15
+ """Initialise the constant with the given name and value"""
16
+ if not isinstance( value, Constant ):
17
+ if isinstance( value, float ) and cls is not FloatConstant:
18
+ return FloatConstant( name, value )
19
+ elif isinstance( value, int ) and cls is not IntConstant:
20
+ return IntConstant( name, value )
21
+ elif isinstance( value, long ) and cls is not LongConstant:
22
+ return LongConstant( name, value )
23
+ elif isinstance( value, (bytes,unicode) ) and cls is not StringConstant:
24
+ return StringConstant( name, as_8_bit(value) )
25
+ if isinstance( value, integer_types ):
26
+ if value > maxsize: # TODO: I'm guessing this should really by sizeof GLint, not
27
+ value = - (value & maxsize)
28
+ base = super(Constant,cls).__new__( cls, value )
29
+ base.name = name
30
+ if _configflags.MODULE_ANNOTATIONS:
31
+ frame = sys._getframe().f_back
32
+ if frame and frame.f_back and '__name__' in frame.f_back.f_globals:
33
+ base.__module__ = frame.f_back.f_globals['__name__']
34
+ return base
35
+ def __repr__( self ):
36
+ """Return the name, rather than the bald value"""
37
+ return self.name
38
+ def __getnewargs__( self ):
39
+ """Produce the new arguments for recreating the instance"""
40
+ return (self.name,) + super( Constant, self ).__getnewargs__()
41
+
42
+ class NumericConstant( Constant ):
43
+ """Base class for numeric-value constants"""
44
+ def __str__( self ):
45
+ """Return the value as a human-friendly string"""
46
+ return '%s (%s)'%(self.name,super(Constant,self).__str__())
47
+ def __getstate__(self):
48
+ """Retrieve state for pickle and the like"""
49
+ return self.name
50
+ def __setstate__( self, state ):
51
+ self.name = state
52
+
53
+ class IntConstant( NumericConstant, int ):
54
+ """Integer constant"""
55
+ if int is not long:
56
+ class LongConstant( NumericConstant, long ):
57
+ """Long integer constant"""
58
+ else:
59
+ LongConstant = IntConstant
60
+ class FloatConstant( NumericConstant, float ):
61
+ """Float constant"""
62
+
63
+ class StringConstant( Constant, bytes ):
64
+ """String constants"""
65
+ def __repr__( self ):
66
+ """Return the value as a human-friendly string"""
67
+ return '%s (%s)'%(self.name,super(Constant,self).__str__())
68
+
69
+ if __name__ == "__main__":
70
+ x = IntConstant( 'testint', 3 )
71
+ y = FloatConstant( 'testfloat', 3.0 )
72
+ z = StringConstant( 'teststr', 'some testing string' )
73
+
74
+ import pickle
75
+ for val in x,y,z:
76
+ restored = pickle.loads( pickle.dumps( val ))
77
+ assert restored == val, (str(restored),str(val))
78
+ assert restored.name == val.name, (restored.name,val.name)
vllm/lib/python3.10/site-packages/OpenGL/constants.py ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ """Backward-compatibility module to provide core-GL constant names"""
2
+ from OpenGL.raw.GL._types import *
3
+ from OpenGL.arrays._arrayconstants import *
vllm/lib/python3.10/site-packages/OpenGL/contextdata.py ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Storage of per-context values of various types
2
+
3
+ Because OpenGL needs persistent references to the
4
+ objects we're constructing to shadow Python objects,
5
+ we have to store references to the objects somewhere
6
+
7
+ For any given Python GUI library, we can use a weakref
8
+ to the library's representation of the GL context to
9
+ call the cleanup function. That means some per-GUI
10
+ library code in OpenGL (or the library), but it gives
11
+ us very natural operations within OpenGL.
12
+
13
+ Note: you can entirely disable use of this module by
14
+ setting:
15
+
16
+ OpenGL.ERROR_ON_COPY = True
17
+ OpenGL.STORE_POINTERS = False
18
+
19
+ before importing OpenGL functionality.
20
+ """
21
+ from OpenGL import platform
22
+ import weakref
23
+ storedPointers = {
24
+ # map from contextID: { constant: value }
25
+ }
26
+ storedWeakPointers = {
27
+ # map from contextID: WeakValueDictionary({ constant: value })
28
+ }
29
+ STORAGES = [ storedPointers, storedWeakPointers ]
30
+
31
+ def getContext( context = None ):
32
+ """Get the context (if passed, just return)
33
+
34
+ context -- the context ID, if None, the current context
35
+ """
36
+ if context is None:
37
+ context = platform.GetCurrentContext()
38
+ if context == 0:
39
+ from OpenGL import error
40
+ raise error.Error(
41
+ """Attempt to retrieve context when no valid context"""
42
+ )
43
+ return context
44
+ def setValue( constant, value, context=None, weak=False ):
45
+ """Set a stored value for the given context
46
+
47
+ constant -- Normally a GL constant value, but can be any hashable value
48
+ value -- the value to be stored. If weak is true must be
49
+ weak-reference-able. If None, then the value will be deleted from
50
+ the storage
51
+ context -- the context identifier for which we're storing the value
52
+ weak -- if true, value will be stored with a weakref
53
+ Note: you should always pass the same value for "weak" for a given
54
+ constant, otherwise you will create two storages for the constant.
55
+ """
56
+ if getattr( value, '_no_cache_', False ):
57
+ return
58
+ context = getContext( context )
59
+ if weak:
60
+ storage = storedWeakPointers
61
+ cls = weakref.WeakValueDictionary
62
+ else:
63
+ storage = storedPointers
64
+ cls = dict
65
+ current = storage.get( context )
66
+ if current is None:
67
+ storage[context] = current = cls()
68
+ previous = current.get( constant )
69
+ if value is None:
70
+ try:
71
+ del current[ constant ]
72
+ except (KeyError,TypeError,ValueError) as err:
73
+ pass
74
+ else:
75
+ # XXX potential for failure here if a non-weakref-able objects
76
+ # is being stored with weak == True
77
+ current[ constant ] = value
78
+ ## print 'previous', previous, value, constant
79
+ return previous
80
+ def delValue( constant, context=None ):
81
+ """Delete the specified value for the given context
82
+
83
+ constant -- Normally a GL constant value, but can be any hashable value
84
+ context -- the context identifier for which we're storing the value
85
+ """
86
+ context = getContext( context )
87
+ found = False
88
+ for storage in STORAGES:
89
+ contextStorage = storage.get( context )
90
+ if contextStorage:
91
+ try:
92
+ del contextStorage[ constant ]
93
+ found = True
94
+ except KeyError as err:
95
+ pass
96
+ return found
97
+
98
+ def getValue( constant, context = None ):
99
+ """Get a stored value for the given constant
100
+
101
+ constant -- unique ID for the type of data being retrieved
102
+ context -- the context ID, if None, the current context
103
+ """
104
+ context = getContext( context )
105
+ for storage in STORAGES:
106
+ contextStorage = storage.get( context )
107
+ if contextStorage:
108
+ value = contextStorage.get( constant )
109
+ if value is not None:
110
+ return value
111
+ return None
112
+
113
+ def cleanupContext( context=None ):
114
+ """Cleanup all held pointer objects for the given context
115
+
116
+ Warning: this is dangerous, as if you call it before a context
117
+ is destroyed you may release memory held by the context and cause
118
+ a protection fault when the GL goes to render the scene!
119
+
120
+ Normally you will want to get the context ID explicitly and then
121
+ register cleanupContext as a weakref callback to your GUI library
122
+ Context object with the (now invalid) context ID as parameter.
123
+ """
124
+ if context is None:
125
+ context = platform.GetCurrentContext()
126
+ for storage in STORAGES:
127
+ try:
128
+ del storedPointers[ context ]
129
+ except KeyError as err:
130
+ return False
131
+ else:
132
+ return True
vllm/lib/python3.10/site-packages/OpenGL/converters.py ADDED
@@ -0,0 +1,316 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Implementations for common converter types"""
2
+ import ctypes,logging
3
+ from OpenGL._bytes import bytes, unicode, as_8_bit
4
+ from OpenGL._null import NULL
5
+ _log = logging.getLogger( 'OpenGL.converters' )
6
+
7
+ class Converter( object ):
8
+ """Base class for Converter types
9
+
10
+ Converter objects are callable objects used with the
11
+ OpenGL.wrapper.Wrapper class to simplify the wrapping
12
+ of functions by collecting commonly used functionality
13
+ into a reusable function.
14
+
15
+ Each Converter has two (class) attributes:
16
+
17
+ argNames -- list of argument names for initialisation
18
+ indexLookups -- set of (indexname, argName,methodName) values
19
+ to lookup on wrapper. These allow us to use argument-name
20
+ references to refer to which arguments to use when
21
+ processing (prevents the need to revise pointers when
22
+ we change the API for a function).
23
+
24
+ Converters can be any of the Wrapper API helper functions,
25
+ so the callable interface can vary among Converter classes.
26
+ """
27
+ argNames = ( )
28
+ indexLookups = ( )
29
+ def __init__( self, *args, **named ):
30
+ """Store arguments in attributes
31
+
32
+ *args -- mapped to self.argNames in order to set attributes
33
+ **named -- mapped to self.argNames by name to set attributes
34
+ """
35
+ argNames = list(self.argNames)
36
+ for a in self.argNames:
37
+ if a in named:
38
+ setattr( self, a, named[a] )
39
+ argNames.remove( a )
40
+ for a,value in zip( argNames, args ):
41
+ setattr( self, a, value )
42
+ def finalise( self, wrapper ):
43
+ """Look up our indices (where appropriate)"""
44
+ for indexname,argName,methodName in self.indexLookups:
45
+ setattr(
46
+ self, indexname,
47
+ getattr(wrapper,methodName)(getattr( self, argName ))
48
+ )
49
+
50
+ # Definitions of the abstract interfaces...
51
+ class PyConverter( Converter ):
52
+ """Converter sub-class for use in Wrapper.pyConverters
53
+
54
+ This class just defines the interface for a pyConverter-style
55
+ Converter object
56
+ """
57
+ def __call__( self, incoming, function, arguments ):
58
+ """Convert incoming argument into compatable data-types
59
+
60
+ incoming -- the Python argument for this parameter
61
+ function -- the wrapper.Wrapper class we are supporting
62
+ arguments -- the complete set of arguments passed to the
63
+ function
64
+
65
+
66
+ """
67
+ raise NotImplemented( """%s class doesn't implement __call__"""%(
68
+ self.__class__.__name__,
69
+ ))
70
+
71
+ class CConverter( Converter ):
72
+ """Converter sub-class for use in Wrapper.cConverters
73
+
74
+ This class just defines the interface for a cConverter-style
75
+ Converter object
76
+ """
77
+ def __call__( self, pyArgs, index, baseOperation ):
78
+ """Calculate C-compatible Python object from Python arguments
79
+
80
+ pyArgs -- set of Python argument objects converted by
81
+ pyConverters from the incoming arguments
82
+ index -- our index in baseOperation.cConverters
83
+ baseOperation -- the Wrapper object which we are supporting
84
+ """
85
+ raise NotImplemented( """%s class doesn't implement __call__"""%(
86
+ self.__class__.__name__,
87
+ ))
88
+ class ReturnValues( Converter ):
89
+ """Converter sub-class for use as Wrapper.returnValues
90
+
91
+ This class just defines the interface for a returnValues-style
92
+ Converter object
93
+ """
94
+ def __call__( self, result, baseOperation, pyArgs, cArgs ):
95
+ """Return a final value to the caller
96
+
97
+ result -- the raw ctypes result value
98
+ baseOperation -- the Wrapper object which we are supporting
99
+ pyArgs -- the set of Python arguments produced by pyConverters
100
+ cArgs -- the set of C-compatible arguments produced by CConverter
101
+
102
+ return the Python object for the final result
103
+ """
104
+ raise NotImplemented( """%s class doesn't implement __call__"""%(
105
+ self.__class__.__name__,
106
+ ))
107
+
108
+ # Now the concrete classes...
109
+ from OpenGL import acceleratesupport
110
+ CallFuncPyConverter = None
111
+ if acceleratesupport.ACCELERATE_AVAILABLE:
112
+ try:
113
+ from OpenGL_accelerate.wrapper import (
114
+ CallFuncPyConverter, DefaultCConverter, getPyArgsName,
115
+ )
116
+ from OpenGL_accelerate.arraydatatype import (
117
+ Output,SizedOutput,OutputOrInput,SizedOutputOrInput
118
+ )
119
+ from OpenGL_accelerate.wrapper import (
120
+ returnCArgument, returnPyArgument,
121
+ )
122
+ except ImportError as err:
123
+ _log.warn(
124
+ "Unable to load converters accelerators (wrapper, arraydatatype) from OpenGL_accelerate"
125
+ )
126
+ CallFuncPyConverter = None
127
+ if CallFuncPyConverter is None:
128
+ class CallFuncPyConverter( PyConverter ):
129
+ """PyConverter that takes a callable and calls it on incoming"""
130
+ def __init__( self, function ):
131
+ """Store the function"""
132
+ self.function = function
133
+ def __call__( self, incoming, function, argument ):
134
+ """Call our function on incoming"""
135
+ return self.function( incoming )
136
+ class DefaultCConverter( CConverter ):
137
+ """NULL or Default CConverter, returns same-named Python argument
138
+
139
+ Used primarily to allow for specifying a converter that explicitly
140
+ says "use the default behaviour". This is *not* a finalise-ing
141
+ converter, it is passed in the index explicitly and just retrieves
142
+ that index from pyArgs when called.
143
+
144
+ Raises informative errors if the index cannot be resolved in pyArgs
145
+ """
146
+ def __init__( self, index ):
147
+ """Just store index for future access"""
148
+ self.index = index
149
+ def __call__( self, pyArgs, index, wrapper ):
150
+ """Return pyArgs[self.index] or raise a ValueError"""
151
+ try:
152
+ return pyArgs[ self.index ]
153
+ except IndexError as err:
154
+ raise ValueError(
155
+ """Expected parameter index %r, but pyArgs only length %s"""%(
156
+ self.index,
157
+ len(pyArgs )
158
+ ))
159
+ class getPyArgsName( CConverter ):
160
+ """CConverter returning named Python argument
161
+
162
+ Intended for use in cConverters, the function returned
163
+ retrieves the named pyArg and returns it when called.
164
+ """
165
+ argNames = ('name',)
166
+ indexLookups = [ ('index','name', 'pyArgIndex' ), ]
167
+ __slots__ = ( 'index', 'name')
168
+ def __call__( self, pyArgs, index, baseOperation ):
169
+ """Return pyArgs[ self.index ]"""
170
+ try:
171
+ return pyArgs[ self.index ]
172
+ except AttributeError as err:
173
+ raise RuntimeError( """"Did not resolve parameter index for %r"""%(self.name))
174
+
175
+ class Output( CConverter ):
176
+ """CConverter generating static-size typed output arrays
177
+
178
+ Produces an output array of given type (arrayType) and
179
+ size using self.lookup() to determine the size of the
180
+ array to be produced, where the lookup function is passed
181
+ as an initialisation argument.
182
+
183
+ Provides also:
184
+
185
+ oldStyleReturn( ... ) for use in the default case of
186
+ PyOpenGL compatability mode, where result arrays of
187
+ size (1,) are returned as scalar values.
188
+ """
189
+ argNames = ('name','size','arrayType' )
190
+ indexLookups = [
191
+ ('outIndex','name', 'cArgIndex' ),
192
+ ]
193
+ __slots__ = ('index','size','arrayType','outIndex','inIndex')
194
+ def __call__( self, pyArgs, index, baseOperation ):
195
+ """Return pyArgs[ self.index ]"""
196
+ return self.arrayType.zeros( self.getSize(pyArgs) )
197
+ def getSize( self, pyArgs ):
198
+ """Retrieve the array size for this argument"""
199
+ return self.size
200
+ def oldStyleReturn( self, result, baseOperation, pyArgs, cArgs ):
201
+ """Retrieve cArgs[ self.index ]"""
202
+ result = cArgs[ self.outIndex ]
203
+ try:
204
+ thisSize = self.getSize(pyArgs)
205
+ except KeyError as err:
206
+ return result
207
+ if thisSize == (1,):
208
+ try:
209
+ return result[0]
210
+ except TypeError as err:
211
+ return result
212
+ else:
213
+ return result
214
+ class OutputOrInput( Output ):
215
+ DO_OUTPUT = (None,NULL)
216
+ def __call__( self, pyArgs, index, baseOperation ):
217
+ for do_output in self.DO_OUTPUT:
218
+ if pyArgs[index] is do_output:
219
+ return super( OutputOrInput,self ).__call__( pyArgs, index, baseOperation )
220
+ return self.arrayType.asArray( pyArgs[index] )
221
+
222
+ class SizedOutput( Output ):
223
+ """Output generating dynamically-sized typed output arrays
224
+
225
+ Takes an extra parameter "specifier", which is the name of
226
+ a Python argument to be passed to the lookup function in order
227
+ to determine the appropriate size for the output array.
228
+ """
229
+ argNames = ('name','specifier','lookup','arrayType' )
230
+ indexLookups = [
231
+ ('outIndex','name', 'cArgIndex' ),
232
+ ('index','specifier', 'pyArgIndex' ),
233
+ ]
234
+ __slots__ = ('index','specifier','lookup','arrayType')
235
+ def getSize( self, pyArgs ):
236
+ """Retrieve the array size for this argument"""
237
+ try:
238
+ specifier = pyArgs[ self.index ]
239
+ except AttributeError as err:
240
+ raise RuntimeError( """"Did not resolve parameter index for %r"""%(self.name))
241
+ else:
242
+ try:
243
+ return self.lookup( specifier )
244
+ except KeyError as err:
245
+ raise KeyError( """Unknown specifier %s"""%( specifier ))
246
+ class SizedOutputOrInput( SizedOutput ):
247
+ DO_OUTPUT = (None,NULL)
248
+ def __call__( self, pyArgs, index, baseOperation ):
249
+ for do_output in self.DO_OUTPUT:
250
+ if pyArgs[index] is do_output:
251
+ return super( SizedOutputOrInput,self ).__call__( pyArgs, index, baseOperation )
252
+ return self.arrayType.asArray( pyArgs[index] )
253
+ class returnCArgument( ReturnValues ):
254
+ """ReturnValues returning the named cArgs value"""
255
+ argNames = ('name',)
256
+ indexLookups = [ ('index','name', 'cArgIndex' ), ]
257
+ __slots__ = ( 'index', 'name' )
258
+ def __call__( self, result, baseOperation, pyArgs, cArgs ):
259
+ """Retrieve cArgs[ self.index ]"""
260
+ return cArgs[self.index]
261
+
262
+ class returnPyArgument( ReturnValues ):
263
+ """ReturnValues returning the named pyArgs value"""
264
+ argNames = ('name',)
265
+ indexLookups = [ ('index','name', 'pyArgIndex' ), ]
266
+ __slots__ = ( 'index', 'name' )
267
+ def __call__( self, result, baseOperation, pyArgs, cArgs ):
268
+ """Retrieve pyArgs[ self.index ]"""
269
+ return pyArgs[self.index]
270
+
271
+ class StringLengths( CConverter ):
272
+ """CConverter for processing array-of-pointers-to-strings data-type
273
+
274
+ Converter is a CConverter for the array-of-lengths for a
275
+ array-of-pointers-to-strings data-type used to pass a set
276
+ of code fragments to the GLSL compiler.
277
+
278
+ Provides also:
279
+
280
+ stringArray -- PyConverter callable ensuring list-of-strings
281
+ format for the python argument
282
+
283
+ stringArrayForC -- CResolver converting the array to
284
+ POINTER(c_char_p) format for passing to C
285
+
286
+ totalCount -- CConverter callable giving count of string
287
+ pointers (that is, length of the pointer array)
288
+ """
289
+ argNames = ('name',)
290
+ indexLookups = [ ('index','name', 'pyArgIndex' ), ]
291
+ __slots__ = ()
292
+ def __call__( self, pyArgs, index, baseOperation ):
293
+ """Get array of length integers for string contents"""
294
+ from OpenGL.raw.GL import _types
295
+ tmp = [len(x) for x in pyArgs[self.index]]
296
+ a_type = _types.GLint * len(tmp)
297
+ return a_type( *tmp )
298
+ def totalCount( self, pyArgs, index, baseOperation ):
299
+ """Get array of length integers for string contents"""
300
+ return len(pyArgs[self.index])
301
+ def stringArray( self, arg, baseOperation, args ):
302
+ """Create basic array-of-strings object from pyArg"""
303
+ if isinstance( arg, (bytes,unicode) ):
304
+ arg = [arg]
305
+ value = [as_8_bit(x) for x in arg]
306
+ return value
307
+ def stringArrayForC( self, strings ):
308
+ """Create a ctypes pointer to char-pointer set"""
309
+ from OpenGL import arrays
310
+ result = (ctypes.c_char_p * len(strings))()
311
+ for i,s in enumerate(strings):
312
+ result[i] = ctypes.cast(
313
+ arrays.GLcharARBArray.dataPointer(s),
314
+ ctypes.c_char_p,
315
+ )
316
+ return result
vllm/lib/python3.10/site-packages/OpenGL/error.py ADDED
@@ -0,0 +1,246 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Implementation of OpenGL errors/exceptions
2
+
3
+ Note that OpenGL-ctypes will also throw standard errors,
4
+ such as TypeError or ValueError when appropriate.
5
+
6
+ ErrorChecker is an _ErrorChecker instance that allows you
7
+ to register a new error-checking function for use
8
+ throughout the system.
9
+ """
10
+ import logging
11
+ _log = logging.getLogger( 'OpenGL.error' )
12
+ from OpenGL import platform, _configflags
13
+ from ctypes import ArgumentError
14
+ __all__ = (
15
+ "Error",'GLError','GLUError','GLUTError',
16
+ 'GLerror','GLUerror','GLUTerror','ArgumentError',
17
+ )
18
+
19
+ class Error( Exception ):
20
+ """Base class for all PyOpenGL-specific exception classes"""
21
+ class NoContext( Error ):
22
+ """Raised to indicate that there is no currently active context
23
+
24
+ Technically almost *any* OpenGL call can segfault if there is
25
+ no active context. The OpenGL.CHECK_CONTEXT flag, if enabled
26
+ will cause this error to be raised whenever a GL or GLU call is
27
+ issued (via PyOpenGL) if there is no currently valid context.
28
+ """
29
+ class CopyError( Error ):
30
+ """Raised to indicate that operation requires data-copying
31
+
32
+ if you set:
33
+ OpenGL.ERROR_ON_COPY = True
34
+
35
+ before importing OpenGL.GL, this error will be raised when
36
+ a passed argument would require a copy to be made.
37
+ """
38
+
39
+ class NullFunctionError( Error ):
40
+ """Error raised when an undefined function is called"""
41
+
42
+ class GLError( Error ):
43
+ """OpenGL core error implementation class
44
+
45
+ Primary purpose of this error class is to allow for
46
+ annotating an error with more details about the calling
47
+ environment so that it's easier to debug errors in the
48
+ wrapping process.
49
+
50
+ Attributes:
51
+
52
+ err -- the OpenGL error code for the error
53
+ result -- the OpenGL result code for the operation
54
+ baseOperation -- the "function" being called
55
+ pyArgs -- the translated set of Python arguments
56
+ cArgs -- the Python objects matching 1:1 the C arguments
57
+ cArguments -- ctypes-level arguments to the operation,
58
+ often raw integers for pointers and the like
59
+ description -- OpenGL description of the error (textual)
60
+ """
61
+ def __init__(
62
+ self,
63
+ err=None,
64
+ result=None,
65
+ cArguments=None,
66
+ baseOperation=None,
67
+ pyArgs=None,
68
+ cArgs=None,
69
+ description=None,
70
+ ):
71
+ """Initialise the GLError, storing metadata for later display"""
72
+ (
73
+ self.err, self.result, self.cArguments,
74
+ self.baseOperation, self.pyArgs, self.cArgs,
75
+ self.description
76
+ ) = (
77
+ err, result, cArguments,
78
+ baseOperation, pyArgs, cArgs,
79
+ description
80
+ )
81
+ DISPLAY_ORDER = (
82
+ 'err',
83
+ 'description',
84
+ 'baseOperation',
85
+ 'pyArgs',
86
+ 'cArgs',
87
+ 'cArguments',
88
+ 'result',
89
+ )
90
+ def __str__( self ):
91
+ """Create a fully formatted representation of the error"""
92
+ args = []
93
+ for property in self.DISPLAY_ORDER:
94
+ value = getattr( self, property, None )
95
+ if value is not None or property=='description':
96
+ formatFunction = 'format_%s'%(property)
97
+ if hasattr( self, formatFunction ):
98
+ args.append( getattr(self,formatFunction)( property, value ))
99
+ else:
100
+ args.append( '%s = %s'%(
101
+ property,
102
+ self.shortRepr( value ),
103
+ ))
104
+ return '%s(\n\t%s\n)'%(self.__class__.__name__, ',\n\t'.join(
105
+ [x for x in args if x]
106
+ ))
107
+ def __repr__( self ):
108
+ """Produce a much shorter version of the error as a string"""
109
+ return '%s( %s )'%(
110
+ self.__class__.__name__,
111
+ ", ".join([x for x in [
112
+ 'err=%s'%(self.err),
113
+ self.format_description( 'description', self.description ) or '',
114
+ self.format_baseOperation( 'baseOperation', self.baseOperation ) or '',
115
+ ] if x])
116
+ )
117
+ def format_description( self, property, value ):
118
+ """Format description using GLU's gluErrorString"""
119
+ if value is None and self.err is not None:
120
+ try:
121
+ from OpenGL.GLU import gluErrorString
122
+ self.description = value = gluErrorString( self.err )
123
+ except Exception as err:
124
+ return None
125
+ if value is None:
126
+ return None
127
+ return '%s = %s'%(
128
+ property,
129
+ self.shortRepr( value ),
130
+ )
131
+ def shortRepr( self, value, firstLevel=True ):
132
+ """Retrieve short representation of the given value"""
133
+ if isinstance( value, (list,tuple) ) and value and len(repr(value))>=40:
134
+ if isinstance( value, list ):
135
+ template = '[\n\t\t%s\n\t]'
136
+ else:
137
+ template = '(\n\t\t%s,\n\t)'
138
+ return template%( ",\n\t\t".join(
139
+ [
140
+ self.shortRepr(x,False) for x in value
141
+ ]
142
+ ))
143
+ r = repr( value )
144
+ if len(r) < 120:
145
+ return r
146
+ else:
147
+ return r[:117] + '...'
148
+ def format_baseOperation( self, property, value ):
149
+ """Format a baseOperation reference for display"""
150
+ if hasattr( value, '__name__' ):
151
+ return '%s = %s'%( property, value.__name__ )
152
+ else:
153
+ return '%s = %r'%( property, value )
154
+
155
+ class GLUError( Error ):
156
+ """GLU error implementation class"""
157
+
158
+ class GLUTError( Error ):
159
+ """GLUT error implementation class"""
160
+
161
+
162
+ if _configflags.ERROR_CHECKING:
163
+ from OpenGL import acceleratesupport
164
+ _ErrorChecker = None
165
+ if acceleratesupport.ACCELERATE_AVAILABLE:
166
+ try:
167
+ from OpenGL_accelerate.errorchecker import _ErrorChecker
168
+ except ImportError as err:
169
+ _log.warn( """OpenGL_accelerate seems to be installed, but unable to import error checking entry point!""" )
170
+ if _ErrorChecker is None:
171
+ class _ErrorChecker( object ):
172
+ """Per-API error-checking object
173
+
174
+ Attributes:
175
+ _registeredChecker -- the checking function enabled when
176
+ not doing onBegin/onEnd processing
177
+ _currentChecker -- currently active checking function
178
+ """
179
+ _getErrors = None
180
+ def __init__( self, platform, baseOperation=None, noErrorResult=0 ):
181
+ """Initialize from a platform module/reference"""
182
+ self._isValid = platform.CurrentContextIsValid
183
+ self._getErrors = baseOperation
184
+ self._noErrorResult = noErrorResult
185
+ if self._getErrors:
186
+ if _configflags.CONTEXT_CHECKING:
187
+ self._registeredChecker = self.safeGetError
188
+ else:
189
+ self._registeredChecker = self._getErrors
190
+ else:
191
+ self._registeredChecker = self.nullGetError
192
+ self._currentChecker = self._registeredChecker
193
+ def __bool__( self ):
194
+ """We are "true" if we actually do anything"""
195
+ if self._registeredChecker is self.nullGetError:
196
+ return False
197
+ return True
198
+ def safeGetError( self ):
199
+ """Check for error, testing for context before operation"""
200
+ if self._isValid():
201
+ return self._getErrors()
202
+ return None
203
+ def nullGetError( self ):
204
+ """Used as error-checker when no error checking should be done"""
205
+ return self._noErrorResult
206
+ def glCheckError(
207
+ self,
208
+ result,
209
+ baseOperation=None,
210
+ cArguments=None,
211
+ *args
212
+ ):
213
+ """Base GL Error checker compatible with new ctypes errcheck protocol
214
+
215
+ This function will raise a GLError with just the calling information
216
+ available at the C-calling level, i.e. the error code, cArguments,
217
+ baseOperation and result. Higher-level code is responsible for any
218
+ extra annotations.
219
+
220
+ Note:
221
+ glCheckError relies on glBegin/glEnd interactions to
222
+ prevent glGetError being called during a glBegin/glEnd
223
+ sequence. If you are calling glBegin/glEnd in C you
224
+ should call onBegin and onEnd appropriately.
225
+ """
226
+ err = self._currentChecker()
227
+ if err != self._noErrorResult:
228
+ raise GLError(
229
+ err,
230
+ result,
231
+ cArguments = cArguments,
232
+ baseOperation = baseOperation,
233
+ )
234
+ return result
235
+ def onBegin( self ):
236
+ """Called by glBegin to record the fact that glGetError won't work"""
237
+ self._currentChecker = self.nullGetError
238
+ def onEnd( self ):
239
+ """Called by glEnd to record the fact that glGetError will work"""
240
+ self._currentChecker = self._registeredChecker
241
+ else:
242
+ _ErrorChecker = None
243
+ # Compatibility with PyOpenGL 2.x series
244
+ GLUerror = GLUError
245
+ GLerror = GLError
246
+ GLUTerror = GLUTError
vllm/lib/python3.10/site-packages/OpenGL/extensions.py ADDED
@@ -0,0 +1,256 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Extension module support methods
2
+
3
+ This module provides the tools required to check whether
4
+ an extension is available
5
+ """
6
+ from OpenGL.latebind import LateBind
7
+ from OpenGL._bytes import bytes,unicode,as_8_bit
8
+ import OpenGL as root
9
+ import sys
10
+ import logging
11
+ _log = logging.getLogger( 'OpenGL.extensions' )
12
+ VERSION_PREFIX = as_8_bit('GL_VERSION_GL_')
13
+ CURRENT_GL_VERSION = None
14
+ AVAILABLE_GL_EXTENSIONS = []
15
+ AVAILABLE_GLU_EXTENSIONS = []
16
+
17
+ # version tuple -> list of implicitly included extensions...
18
+ VERSION_EXTENSIONS = [
19
+ ((3,0), [
20
+ as_8_bit('GL_ARB_vertex_array_object'),
21
+ as_8_bit('GL_ARB_texture_buffer_object'),
22
+ as_8_bit('GL_ARB_framebuffer_object'),
23
+ as_8_bit('GL_ARB_map_buffer_range'),
24
+ ]),
25
+ ((3,1), [
26
+ as_8_bit('GL_ARB_copy_buffer'),
27
+ as_8_bit('GL_ARB_uniform_buffer_object'),
28
+ ]),
29
+ ((3,2), [
30
+ as_8_bit('GL_ARB_draw_elements_base_vertex'),
31
+ as_8_bit('GL_ARB_provoking_vertex'),
32
+ as_8_bit('GL_ARB_sync'),
33
+ as_8_bit('GL_ARB_texture_multisample'),
34
+ ]),
35
+ ((3,3), [
36
+ as_8_bit('GL_ARB_texture_multisample'),
37
+ as_8_bit('GL_ARB_blend_func_extended'),
38
+ as_8_bit('GL_ARB_sampler_objects'),
39
+ as_8_bit('GL_ARB_explicit_attrib_location'),
40
+ as_8_bit('GL_ARB_occlusion_query2'),
41
+ as_8_bit('GL_ARB_shader_bit_encoding'),
42
+ as_8_bit('GL_ARB_texture_rgb10_a2ui'),
43
+ as_8_bit('GL_ARB_texture_swizzle'),
44
+ as_8_bit('GL_ARB_timer_query'),
45
+ as_8_bit('GL_ARB_vertex_type_2_10_10_10_rev'),
46
+ ]),
47
+ ((4,0), [
48
+ as_8_bit('GL_ARB_texture_query_lod'),
49
+ as_8_bit('GL_ARB_draw_indirect'),
50
+ as_8_bit('GL_ARB_gpu_shader5'),
51
+ as_8_bit('GL_ARB_gpu_shader_fp64'),
52
+ as_8_bit('GL_ARB_shader_subroutine'),
53
+ as_8_bit('GL_ARB_tessellation_shader'),
54
+ as_8_bit('GL_ARB_texture_buffer_object_rgb32'),
55
+ as_8_bit('GL_ARB_texture_cube_map_array'),
56
+ as_8_bit('GL_ARB_texture_gather'),
57
+ as_8_bit('GL_ARB_transform_feedback2'),
58
+ as_8_bit('GL_ARB_transform_feedback3'),
59
+ ]),
60
+ ((4,1), [
61
+ as_8_bit('GL_ARB_ES2_compatibility'),
62
+ as_8_bit('GL_ARB_get_program_binary'),
63
+ as_8_bit('GL_ARB_separate_shader_objects'),
64
+ as_8_bit('GL_ARB_shader_precision'),
65
+ as_8_bit('GL_ARB_vertex_attrib_64bit'),
66
+ as_8_bit('GL_ARB_viewport_array'),
67
+ ]),
68
+ ((4,2), [
69
+ as_8_bit('GL_ARB_base_instance'),
70
+ as_8_bit('GL_ARB_shading_language_420pack'),
71
+ as_8_bit('GL_ARB_transform_feedback_instanced'),
72
+ as_8_bit('GL_ARB_compressed_texture_pixel_storage'),
73
+ as_8_bit('GL_ARB_conservative_depth'),
74
+ as_8_bit('GL_ARB_internalformat_query'),
75
+ as_8_bit('GL_ARB_map_buffer_alignment'),
76
+ as_8_bit('GL_ARB_shader_atomic_counters'),
77
+ as_8_bit('GL_ARB_shader_image_load_store'),
78
+ as_8_bit('GL_ARB_shading_language_packing'),
79
+ as_8_bit('GL_ARB_texture_storage'),
80
+ ]),
81
+ ]
82
+
83
+ class ExtensionQuerier( object ):
84
+ prefix = None
85
+ version_prefix = None
86
+ assumed_version = [1,0]
87
+
88
+ version = extensions = None
89
+ version_string = extensions_string = None
90
+
91
+ registered = []
92
+ def __init__( self ):
93
+ self.registered.append( self )
94
+
95
+ @classmethod
96
+ def hasExtension( self, specifier ):
97
+ for registered in self.registered:
98
+ result = registered( specifier )
99
+ if result:
100
+ return result
101
+ return False
102
+
103
+ def __call__( self, specifier ):
104
+ specifier = as_8_bit(specifier).replace(as_8_bit('.'),as_8_bit('_'))
105
+ if not specifier.startswith( self.prefix ):
106
+ return None
107
+
108
+ if specifier.startswith( self.version_prefix ):
109
+ specifier = [
110
+ int(x)
111
+ for x in specifier[ len(self.version_prefix):].split(as_8_bit('_'))
112
+ ]
113
+ if specifier[:2] <= self.assumed_version:
114
+ return True
115
+ version = self.getVersion()
116
+ if not version:
117
+ return version
118
+ return specifier <= version
119
+ else:
120
+ extensions = self.getExtensions()
121
+ return extensions and specifier in extensions
122
+ def getVersion( self ):
123
+ if not self.version:
124
+ self.version = self.pullVersion()
125
+ return self.version
126
+ def getExtensions( self ):
127
+ if not self.extensions:
128
+ self.extensions = self.pullExtensions()
129
+ return self.extensions
130
+
131
+ class _GLQuerier( ExtensionQuerier ):
132
+ prefix = as_8_bit('GL_')
133
+ version_prefix = as_8_bit('GL_VERSION_GL_')
134
+ assumed_version = [1,1]
135
+ def pullVersion( self ):
136
+ """Retrieve 2-int declaration of major/minor GL version
137
+
138
+ returns [int(major),int(minor)] or False if not loaded
139
+ """
140
+ from OpenGL import platform
141
+ if not platform.PLATFORM.CurrentContextIsValid():
142
+ return False
143
+ from OpenGL.raw.GL.VERSION.GL_1_1 import glGetString
144
+ from OpenGL.raw.GL.VERSION.GL_1_1 import GL_VERSION
145
+ new = glGetString( GL_VERSION )
146
+
147
+ self.version_string = new
148
+ if new:
149
+ return [
150
+ int(x) for x in new.split(as_8_bit(' '),1)[0].split( as_8_bit('.') )
151
+ ]
152
+ else:
153
+ return False # not yet loaded/supported
154
+ def pullExtensions( self ):
155
+ from OpenGL import platform
156
+ if not platform.PLATFORM.CurrentContextIsValid():
157
+ return False
158
+ from OpenGL.raw.GL._types import GLint
159
+ from OpenGL.raw.GL.VERSION.GL_1_1 import glGetString, glGetError
160
+ from OpenGL.raw.GL.VERSION.GL_1_1 import GL_EXTENSIONS
161
+ from OpenGL import error
162
+ try:
163
+ extensions = glGetString( GL_EXTENSIONS )
164
+ if glGetError():
165
+ raise error.GLError()
166
+ if extensions:
167
+ extensions = extensions.split()
168
+ else:
169
+ return False
170
+ except (AttributeError, error.GLError) as err:
171
+ # OpenGL 3.0 deprecates glGetString( GL_EXTENSIONS )
172
+ from OpenGL.raw.GL.VERSION.GL_3_0 import GL_NUM_EXTENSIONS, glGetStringi
173
+ from OpenGL.raw.GL.VERSION.GL_1_1 import glGetIntegerv
174
+ count = GLint()
175
+ glGetIntegerv( GL_NUM_EXTENSIONS, count )
176
+ extensions = []
177
+ for i in range( count.value ):
178
+ extension = glGetStringi( GL_EXTENSIONS, i )
179
+ extensions.append(
180
+ extension
181
+ )
182
+ # Add included-by-reference extensions...
183
+ version = self.getVersion()
184
+ if not version:
185
+ # should not be possible?
186
+ return version
187
+ check = tuple( version[:2] )
188
+ for (v,v_exts) in VERSION_EXTENSIONS:
189
+ if v <= check:
190
+ for v_ext in v_exts:
191
+ if v_ext not in extensions:
192
+ extensions.append( as_8_bit(v_ext) )
193
+ else:
194
+ break
195
+ return extensions
196
+ GLQuerier = _GLQuerier()
197
+ class _GLUQuerier( ExtensionQuerier ):
198
+ prefix = as_8_bit('GLU_')
199
+ version_prefix = as_8_bit('GLU_VERSION_GL_')
200
+ def pullVersion( self ):
201
+ from OpenGL.GLU import gluGetString,GLU_VERSION
202
+ return [
203
+ int(x) for x in gluGetString( GLU_VERSION ).split('_')
204
+ if x.isdigit()
205
+ ]
206
+ def pullExtensions( self ):
207
+ from OpenGL.GLU import gluGetString,GLU_EXTENSIONS
208
+ return gluGetString( GLU_EXTENSIONS ).split()
209
+ GLUQuerier = _GLUQuerier()
210
+
211
+ def hasExtension( specifier ):
212
+ return ExtensionQuerier.hasExtension( specifier )
213
+ hasGLExtension = hasGLUExtension = hasExtension
214
+
215
+ class _Alternate( LateBind ):
216
+ def __init__( self, name, *alternates ):
217
+ """Initialize set of alternative implementations of the same function"""
218
+ self.__name__ = name
219
+ self._alternatives = alternates
220
+ if root.MODULE_ANNOTATIONS:
221
+ frame = sys._getframe().f_back
222
+ if frame and frame.f_back and '__name__' in frame.f_back.f_globals:
223
+ self.__module__ = frame.f_back.f_globals['__name__']
224
+ def __bool__( self ):
225
+ from OpenGL import error
226
+ try:
227
+ return bool( self.getFinalCall())
228
+ except error.NullFunctionError as err:
229
+ return False
230
+ __nonzero__ = __bool__ # Python 2.6 compatibility
231
+ def finalise( self ):
232
+ """Call, doing a late lookup and bind to find an implementation"""
233
+ for alternate in self._alternatives:
234
+ if alternate:
235
+ # _log.info(
236
+ # """Chose alternate: %s from %s""",
237
+ # alternate.__name__,
238
+ # ", ".join([x.__name__ for x in self._alternatives])
239
+ # )
240
+ return alternate
241
+ from OpenGL import error
242
+ raise error.NullFunctionError(
243
+ """Attempt to call an undefined alternate function (%s), check for bool(%s) before calling"""%(
244
+ ', '.join([x.__name__ for x in self._alternatives]),
245
+ self.__name__,
246
+ )
247
+ )
248
+ def alternate( name, *functions ):
249
+ """Construct a callable that functions as the first implementation found of given set of alternatives
250
+
251
+ if name is a function then its name will be used....
252
+ """
253
+ if not isinstance( name, (bytes,unicode)):
254
+ functions = (name,)+functions
255
+ name = name.__name__
256
+ return type( name, (_Alternate,), {} )( name, *functions )
vllm/lib/python3.10/site-packages/OpenGL/images.py ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Image/texture implementation code
2
+
3
+ This module provides the Pan-OpenGL operations required to support OpenGL
4
+ image handling. Most of this code is simply boilerplate code that sets
5
+ OpenGL parameters such that normal Pythonic assumptions about data-ordering
6
+ are met to allow easier interaction with other projects (such as PIL or
7
+ Numpy).
8
+
9
+ Generally speaking, there are 3 pieces of information which control how
10
+ an image is processed in the system:
11
+
12
+ format -- this is the pixel format, such as GL_RGB/GL_RED/GL_ABGR_EXT
13
+ dims -- tuple of dimensions for the image, (width,height,depth) order
14
+ type -- the storage data-type for the image, normally GL_UNSIGNED_BYTE
15
+ when working in Python, but all of the standard OpenGL types for
16
+ images can be used if you happen to have your data in some exotic
17
+ format.
18
+
19
+ OpenGL.UNSIGNED_BYTE_IMAGES_AS_STRING -- if this global value is set,
20
+ then read of unsigned byte images using glReadPixels and
21
+ glGetTexImage produces a string instead of the default array format.
22
+
23
+ Attributes of Note:
24
+
25
+ COMPONENT_COUNTS -- used to lookup how many units of a
26
+ given storage type are required to store a unit in a given format
27
+
28
+ TYPE_TO_ARRAYTYPE -- maps Image storage types to their array data-type
29
+ constants, i.e. maps GL_UNSIGNED_SHORT_4_4_4_4 to GL_UNSIGNED_SHORT
30
+ so that we can use the standard array types for manipulating
31
+ image arrays.
32
+
33
+ RANK_PACKINGS -- commands required to set up default array-transfer
34
+ operations for an array of the specified rank.
35
+
36
+ New image formats and types will need to be registered here to be supported,
37
+ this means that extension modules which add image types/formats need to alter
38
+ the tables described above!
39
+
40
+ XXX Should be an API to handle that instead of direct modification.
41
+
42
+ """
43
+ from OpenGL.raw.GL.VERSION import GL_1_1 as _simple
44
+ from OpenGL import arrays
45
+ from OpenGL import _configflags
46
+ import ctypes
47
+
48
+ def SetupPixelRead( format, dims, type):
49
+ """Setup transfer mode for a read into a numpy array return the array
50
+
51
+ Calls setupDefaultTransferMode, sets rankPacking and then
52
+ returns a createTargetArray for the parameters.
53
+ """
54
+ setupDefaultTransferMode()
55
+ # XXX this is wrong? dims may grow or it may not, depends on whether
56
+ # the format can fit in the type or not, but rank is a property of the
57
+ # image itself? Don't know, should test.
58
+ rankPacking( len(dims)+1 )
59
+ return createTargetArray( format, dims, type )
60
+
61
+ def setupDefaultTransferMode( ):
62
+ """Set pixel transfer mode to assumed internal structure of arrays
63
+
64
+ Basically OpenGL-ctypes (and PyOpenGL) assume that your image data is in
65
+ non-byte-swapped order, with big-endian ordering of bytes (though that
66
+ seldom matters in image data). These assumptions are normally correct
67
+ when dealing with Python libraries which expose byte-arrays.
68
+ """
69
+ _simple.glPixelStorei(_simple.GL_PACK_SWAP_BYTES, 0)
70
+ _simple.glPixelStorei(_simple.GL_PACK_LSB_FIRST, 0)
71
+ def rankPacking( rank ):
72
+ """Set the pixel-transfer modes for a given image "rank" (# of dims)
73
+
74
+ Uses RANK_PACKINGS table to issue calls to glPixelStorei
75
+ """
76
+ for func,which,arg in RANK_PACKINGS[rank]:
77
+ try:
78
+ func(which,arg)
79
+ except Exception as err:
80
+ # XXX should be logging a warning!
81
+ pass
82
+
83
+ def createTargetArray( format, dims, type ):
84
+ """Create storage array for given parameters
85
+
86
+ If storage type requires > 1 unit per format pixel, then dims will be
87
+ extended by 1, so in the common case of RGB and GL_UNSIGNED_BYTE you
88
+ will wind up with an array of dims + (3,) dimensions. See
89
+ COMPONENT_COUNTS for table which controls which formats produce
90
+ larger dimensions. The secondary table TIGHT_PACK_FORMATS overrides
91
+ this case, so that image formats registered as TIGHT_PACK_FORMATS
92
+ only ever return a dims-shaped value. TIGHT_PACK_FORMATS will raise
93
+ ValueErrors if they are used with a format that does not have the same
94
+ number of components as they define.
95
+
96
+ Note that the base storage type must provide a zeros method. The zeros
97
+ method relies on their being a registered default array-implementation for
98
+ the storage type. The default installation of OpenGL-ctypes will use
99
+ Numpy arrays for returning the result.
100
+ """
101
+ # calculate the number of storage elements required to store
102
+ # a single pixel of format, that's the dimension of the resulting array
103
+ componentCount = formatToComponentCount( format )
104
+ if componentCount > 1:
105
+ if type not in TIGHT_PACK_FORMATS:
106
+ # requires multiple elements to store a single pixel (common)
107
+ # e.g. byte array (typeBits = 8) with RGB (24) or RGBA (32)
108
+ dims += (componentCount, )
109
+ elif TIGHT_PACK_FORMATS[ type ] < componentCount:
110
+ raise ValueError(
111
+ """Image type: %s supports %s components, but format %s requires %s components"""%(
112
+ type,
113
+ TIGHT_PACK_FORMATS[ type ],
114
+ format,
115
+ componentCount,
116
+ )
117
+ )
118
+ arrayType = arrays.GL_CONSTANT_TO_ARRAY_TYPE[ TYPE_TO_ARRAYTYPE.get(type,type) ]
119
+ return arrayType.zeros( dims )
120
+
121
+ def formatToComponentCount( format ):
122
+ """Given an OpenGL image format specification, get components/pixel"""
123
+ size = COMPONENT_COUNTS.get( format )
124
+ if size is None:
125
+ raise ValueError( """Unrecognised image format: %r"""%(format,))
126
+ return size
127
+
128
+ def returnFormat( data, type ):
129
+ """Perform compatibility conversion for PyOpenGL 2.x image-as string results
130
+
131
+ Uses OpenGL.UNSIGNED_BYTE_IMAGES_AS_STRING to control whether to perform the
132
+ conversions.
133
+ """
134
+ if _configflags.UNSIGNED_BYTE_IMAGES_AS_STRING:
135
+ if type == _simple.GL_UNSIGNED_BYTE:
136
+ if hasattr( data, 'tostring' ):
137
+ return data.tostring()
138
+ elif hasattr( data, 'raw' ):
139
+ return data.raw
140
+ elif hasattr( data, '_type_' ):
141
+ s = ctypes.string_at( ctypes.cast( data, ctypes.c_voidp ), ctypes.sizeof( data ))
142
+ result = s[:] # copy into a new string
143
+ return s
144
+ return data
145
+
146
+
147
+ COMPONENT_COUNTS = {
148
+ # Image-format-constant: number-of-components (integer)
149
+ }
150
+ TYPE_TO_BITS = {
151
+ # GL-image-storage-type-constant: number-of-bits (integer)
152
+ }
153
+ TYPE_TO_ARRAYTYPE = {
154
+ # GL-image-storage-type-constant: GL-datatype (constant)
155
+ }
156
+ TIGHT_PACK_FORMATS = {
157
+ }
158
+ RANK_PACKINGS = {
159
+ # rank (integer): list of (function,**arg) to setup for that rank
160
+ }
vllm/lib/python3.10/site-packages/OpenGL/latebind.py ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Late-bound base-class (with acceleration)"""
2
+ from OpenGL import acceleratesupport
3
+ LateBind = Curry = None
4
+ if acceleratesupport.ACCELERATE_AVAILABLE:
5
+ try:
6
+ from OpenGL_accelerate.latebind import LateBind, Curry
7
+ except ImportError as err:
8
+ pass
9
+ if LateBind is None:
10
+ class LateBind(object):
11
+ """Provides a __call__ which dispatches to self._finalCall
12
+
13
+ When called without self._finalCall() makes a call to
14
+ self.finalise() and then calls self._finalCall()
15
+ """
16
+ _finalCall = None
17
+ def setFinalCall( self, finalCall ):
18
+ """Set our finalCall to the callable object given"""
19
+ self._finalCall = finalCall
20
+ def getFinalCall( self ):
21
+ """Retrieve and/or bind and retrieve final call"""
22
+ if not self._finalCall:
23
+ self._finalCall = self.finalise()
24
+ return self._finalCall
25
+
26
+
27
+ def finalise( self ):
28
+ """Finalise our target to our final callable object
29
+
30
+ return final callable
31
+ """
32
+
33
+ def __call__( self, *args, **named ):
34
+ """Call self._finalCall, calling finalise() first if not already called
35
+
36
+ There's actually *no* reason to unpack and repack the arguments,
37
+ but unfortunately I don't know of a Cython syntax to specify
38
+ that.
39
+ """
40
+ try:
41
+ return self._finalCall( *args, **named )
42
+ except (TypeError,AttributeError) as err:
43
+ if self._finalCall is None:
44
+ self._finalCall = self.finalise()
45
+ return self._finalCall( *args, **named )
46
+ if Curry is None:
47
+ class Curry(object):
48
+ """Provides a simple Curry which can bind (only) the first element
49
+
50
+ This is used by lazywrapper, which explains the weird naming
51
+ of the two attributes...
52
+ """
53
+ wrapperFunction = None
54
+ baseFunction = None
55
+ def __init__( self, wrapperFunction, baseFunction ):
56
+ """Stores self.wrapperFunction and self.baseFunction"""
57
+ self.baseFunction = baseFunction
58
+ self.wrapperFunction = wrapperFunction
59
+ def __call__( self, *args, **named ):
60
+ """returns self.wrapperFunction( self.baseFunction, *args, **named )"""
61
+ return self.wrapperFunction( self.baseFunction, *args, **named )
vllm/lib/python3.10/site-packages/OpenGL/lazywrapper.py ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Simplistic wrapper decorator for Python-coded wrappers"""
2
+ from OpenGL.latebind import Curry
3
+ from OpenGL import MODULE_ANNOTATIONS
4
+
5
+ class _LazyWrapper( Curry ):
6
+ """Marker to tell us that an object is a lazy wrapper"""
7
+
8
+ def lazy( baseFunction ):
9
+ """Produce a lazy-binding decorator that uses baseFunction
10
+
11
+ Allows simple implementation of wrappers where the
12
+ whole of the wrapper can be summed up as do 1 thing
13
+ then call base function with the cleaned up result.
14
+
15
+ Passes baseFunction in as the first argument of the
16
+ wrapped function, all other parameters are passed
17
+ unchanged. The wrapper class created has __nonzero__
18
+ and similar common wrapper entry points defined.
19
+ """
20
+ def wrap( wrapper ):
21
+ """Wrap wrapper with baseFunction"""
22
+ def __nonzero__( self ):
23
+ return bool( baseFunction )
24
+ def __repr__( self ):
25
+ return '%s( %r )'%(
26
+ 'OpenGL.lazywrapper.lazy',
27
+ baseFunction.__name__,
28
+ )
29
+ _with_wrapper = type( wrapper.__name__, (_LazyWrapper,), {
30
+ '__repr__': __repr__,
31
+ '__doc__': wrapper.__doc__,
32
+ '__nonzero__': __nonzero__,
33
+ 'wrappedOperation': baseFunction,
34
+ 'restype': getattr(wrapper, 'restype',getattr(baseFunction,'restype',None)),
35
+ } )
36
+ with_wrapper = _with_wrapper(wrapper,baseFunction)
37
+ with_wrapper.__name__ = wrapper.__name__
38
+ if hasattr( baseFunction, '__module__' ):
39
+ with_wrapper.__module__ = baseFunction.__module__
40
+ return with_wrapper
41
+ return wrap
42
+
43
+
44
+ if __name__ == "__main__":
45
+ from OpenGL.raw import GLU
46
+ func = GLU.gluNurbsCallbackData
47
+ output = []
48
+ def testwrap( base ):
49
+ "Testing"
50
+ output.append( base )
51
+ testlazy = lazy( func )( testwrap )
52
+ testlazy( )
53
+ assert testlazy.__doc__ == "Testing"
54
+ assert testlazy.__class__.__name__ == 'testwrap'
55
+ assert testlazy.__name__ == 'testwrap'
56
+ assert testlazy.baseFunction is func
57
+ assert testlazy.wrapperFunction is testwrap
58
+ assert output
vllm/lib/python3.10/site-packages/OpenGL/logs.py ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Fix missing-API problems in logging module (circa Python 2.3)
2
+
3
+ Adds constants to the log objects.
4
+ Adds getException(err) to log objects to retrieve
5
+ formatted exception or err if traceback not available.
6
+ """
7
+ import traceback, logging
8
+ from OpenGL._configflags import ERROR_LOGGING, FULL_LOGGING
9
+ getLog = logging.getLogger
10
+
11
+ def getException(error):
12
+ """Get formatted traceback from exception"""
13
+ try:
14
+ return traceback.format_exc( limit=10 )
15
+ except Exception as err:
16
+ return str( error )
17
+
18
+ logging.Logger.getException = staticmethod( getException )
19
+ logging.Logger.err = logging.Logger.error
20
+ logging.Logger.DEBUG = logging.DEBUG
21
+ logging.Logger.WARN = logging.WARN
22
+ logging.Logger.INFO = logging.INFO
23
+ logging.Logger.ERR = logging.Logger.ERROR = logging.ERROR
24
+
25
+ if FULL_LOGGING:
26
+ getLog( 'OpenGL.calltrace' ).setLevel( logging.INFO )
27
+
28
+ class _LoggedFunction( object ):
29
+ """Proxy that overrides __call__ to log arguments"""
30
+ def __init__( self, base, log ):
31
+ self.__dict__[''] = base
32
+ self.__dict__['log'] = log
33
+ def __setattr__( self, key, value ):
34
+ if key != '':
35
+ setattr( self.__dict__[''], key, value )
36
+ else:
37
+ self.__dict__[''] = value
38
+ def __getattr__( self, key ):
39
+ if key == '':
40
+ return self.__dict__['']
41
+ else:
42
+ return getattr( self.__dict__[''], key )
43
+ class _FullLoggedFunction( _LoggedFunction ):
44
+ """Fully-logged function wrapper (logs all call params to OpenGL.calltrace)"""
45
+ _callTrace = getLog( 'OpenGL.calltrace' )
46
+ def __call__( self, *args, **named ):
47
+ argRepr = []
48
+ function = getattr( self, '' )
49
+ for arg in args:
50
+ argRepr.append( repr(arg) )
51
+ for key,value in named.items():
52
+ argRepr.append( '%s = %s'%( key,repr(value)) )
53
+ argRepr = ",".join( argRepr )
54
+ self._callTrace.info( '%s( %s )', function.__name__, argRepr )
55
+ try:
56
+ return function( *args, **named )
57
+ except Exception as err:
58
+ self.log.warn(
59
+ """Failure on %s: %s""", function.__name__, self.log.getException( err )
60
+ )
61
+ raise
62
+ class _ErrorLoggedFunction ( _LoggedFunction ):
63
+ """On-error-logged function wrapper"""
64
+ def __call__( self, *args, **named ):
65
+ function = getattr( self, '' )
66
+ try:
67
+ return function( *args, **named )
68
+ except Exception as err:
69
+ self.log.warn(
70
+ """Failure on %s: %s""", function.__name__, self.log.getException( err )
71
+ )
72
+ raise
73
+
74
+
75
+ def logOnFail( function, log ):
76
+ """Produce possible log-wrapped version of function
77
+
78
+ function -- callable object to be wrapped
79
+ log -- the log to which to log information
80
+
81
+ Uses ERROR_LOGGING and FULL_LOGGING
82
+ to determine whether/how to wrap the function.
83
+ """
84
+ if ERROR_LOGGING or FULL_LOGGING:
85
+ if FULL_LOGGING:
86
+ loggedFunction = _FullLoggedFunction( function, log )
87
+ else:
88
+ loggedFunction = _ErrorLoggedFunction( function, log )
89
+ return loggedFunction
90
+ else:
91
+ return function