Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- vllm/lib/python3.10/site-packages/OpenGL/GL/GREMEDY/__init__.py +1 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/GREMEDY/__pycache__/__init__.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/GREMEDY/__pycache__/frame_terminator.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/GREMEDY/__pycache__/string_marker.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/GREMEDY/frame_terminator.py +47 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/GREMEDY/string_marker.py +54 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/INTEL/__init__.py +1 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/INTEL/__pycache__/__init__.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/INTEL/__pycache__/fragment_shader_ordering.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/INTEL/__pycache__/map_texture.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/INTEL/__pycache__/parallel_arrays.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/INTEL/__pycache__/performance_query.cpython-310.pyc +0 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/INTEL/fragment_shader_ordering.py +51 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/INTEL/map_texture.py +43 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/INTEL/parallel_arrays.py +38 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/INTEL/performance_query.py +23 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/SGIX/blend_alpha_minmax.py +32 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/SGIX/calligraphic_fragment.py +23 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/SGIX/depth_pass_instrument.py +23 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/SGIX/fog_offset.py +40 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/SGIX/fragment_lighting.py +58 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/SGIX/igloo_interface.py +26 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/SGIX/instruments.py +64 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/SGIX/interlace.py +33 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/SGIX/ir_instrument1.py +26 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/SGIX/list_priority.py +43 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/SGIX/pixel_texture.py +23 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/SGIX/pixel_tiles.py +23 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/SGIX/polynomial_ffd.py +30 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/SGIX/reference_plane.py +49 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/SGIX/scalebias_hint.py +23 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/SGIX/shadow.py +31 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/SGIX/subsample.py +23 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/SGIX/tag_sample_buffer.py +32 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/SGIX/texture_coordinate_clamp.py +31 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/SGIX/texture_scale_bias.py +38 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/SGIX/vertex_preclip.py +39 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/SGIX/ycrcb.py +52 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/SGIX/ycrcb_subsample.py +23 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/__init__.py +47 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/exceptional.py +278 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/feedback.py +86 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/framebufferobjects.py +57 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/glget.py +24 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/images.py +639 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/pointers.py +308 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/selection.py +64 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/shaders.py +228 -0
- vllm/lib/python3.10/site-packages/OpenGL/GL/vboimplementation.py +21 -0
- vllm/lib/python3.10/site-packages/OpenGL/arrays/__pycache__/__init__.cpython-310.pyc +0 -0
vllm/lib/python3.10/site-packages/OpenGL/GL/GREMEDY/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
"""OpenGL Extensions"""
|
vllm/lib/python3.10/site-packages/OpenGL/GL/GREMEDY/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (196 Bytes). View file
|
|
|
vllm/lib/python3.10/site-packages/OpenGL/GL/GREMEDY/__pycache__/frame_terminator.cpython-310.pyc
ADDED
|
Binary file (2.19 kB). View file
|
|
|
vllm/lib/python3.10/site-packages/OpenGL/GL/GREMEDY/__pycache__/string_marker.cpython-310.pyc
ADDED
|
Binary file (2.5 kB). View file
|
|
|
vllm/lib/python3.10/site-packages/OpenGL/GL/GREMEDY/frame_terminator.py
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'''OpenGL extension GREMEDY.frame_terminator
|
| 2 |
+
|
| 3 |
+
This module customises the behaviour of the
|
| 4 |
+
OpenGL.raw.GL.GREMEDY.frame_terminator to provide a more
|
| 5 |
+
Python-friendly API
|
| 6 |
+
|
| 7 |
+
Overview (from the spec)
|
| 8 |
+
|
| 9 |
+
This extension defines a mechanism that enables marking the end
|
| 10 |
+
of render frames within the OpenGL stream.
|
| 11 |
+
|
| 12 |
+
When debugging or profiling an OpenGL application, the debuggers
|
| 13 |
+
and profilers needs to know when a render frame is ended. This
|
| 14 |
+
is important for frame per second measurements, statistical analysis,
|
| 15 |
+
marking and clearing stream loggers logs, performance counters
|
| 16 |
+
sampling and more.
|
| 17 |
+
|
| 18 |
+
When an application uses off screen buffers, the debugger / profiler
|
| 19 |
+
cannot be guaranteed that the application will call a certain function at
|
| 20 |
+
the end of each off-screen frame (e.g: SwapBuffers / glClear / etc).
|
| 21 |
+
This extension enables the application to notify the debugger / profiler
|
| 22 |
+
whenever a render frame is ended.
|
| 23 |
+
|
| 24 |
+
This extension is mainly useful for debuggers and profilers. It is not
|
| 25 |
+
expected that standard drivers would implement this extension. The main
|
| 26 |
+
point of having this extension is to allow applications to have a clean
|
| 27 |
+
way of accessing this functionality only when they are run under the
|
| 28 |
+
control of a debugger / profiler, without having to recompile or change
|
| 29 |
+
the application source code.
|
| 30 |
+
|
| 31 |
+
The official definition of this extension is available here:
|
| 32 |
+
http://www.opengl.org/registry/specs/GREMEDY/frame_terminator.txt
|
| 33 |
+
'''
|
| 34 |
+
from OpenGL import platform, constant, arrays
|
| 35 |
+
from OpenGL import extensions, wrapper
|
| 36 |
+
import ctypes
|
| 37 |
+
from OpenGL.raw.GL import _types, _glgets
|
| 38 |
+
from OpenGL.raw.GL.GREMEDY.frame_terminator import *
|
| 39 |
+
from OpenGL.raw.GL.GREMEDY.frame_terminator import _EXTENSION_NAME
|
| 40 |
+
|
| 41 |
+
def glInitFrameTerminatorGREMEDY():
|
| 42 |
+
'''Return boolean indicating whether this extension is available'''
|
| 43 |
+
from OpenGL import extensions
|
| 44 |
+
return extensions.hasGLExtension( _EXTENSION_NAME )
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
### END AUTOGENERATED SECTION
|
vllm/lib/python3.10/site-packages/OpenGL/GL/GREMEDY/string_marker.py
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'''OpenGL extension GREMEDY.string_marker
|
| 2 |
+
|
| 3 |
+
This module customises the behaviour of the
|
| 4 |
+
OpenGL.raw.GL.GREMEDY.string_marker to provide a more
|
| 5 |
+
Python-friendly API
|
| 6 |
+
|
| 7 |
+
Overview (from the spec)
|
| 8 |
+
|
| 9 |
+
This extension defines a mechanism to insert textual markers into
|
| 10 |
+
the OpenGL stream.
|
| 11 |
+
|
| 12 |
+
When debugging or profiling an OpenGL application some of the most
|
| 13 |
+
important tools are stream loggers, which just output a list of the
|
| 14 |
+
called OpenGL commands, and profilers, which show at which points
|
| 15 |
+
the pipeline is bottlenecked for a given part of the frame. The
|
| 16 |
+
problem in using these is that there is a definite loss of
|
| 17 |
+
information between the application and the used debugger/profiler.
|
| 18 |
+
The application generally has a pretty good idea what is rendered
|
| 19 |
+
when (e.g. rendering background, landscape, building, players,
|
| 20 |
+
particle effects, bullets etc.), but the debugger/profiler only
|
| 21 |
+
sees the OpenGL stream. To analyze the stream developers have to
|
| 22 |
+
guess what is done when by following the program code and the log
|
| 23 |
+
output in parallel, which can get difficult for systems that
|
| 24 |
+
restructure their internal pipeline or do lazy changes.
|
| 25 |
+
|
| 26 |
+
This extension is really only useful for these debuggers and
|
| 27 |
+
profilers, and not for actual drivers. In fact, it is not expected
|
| 28 |
+
that any standard driver would ever implement this extension. The
|
| 29 |
+
main point of having this extension is to allow applications to have a
|
| 30 |
+
clean way of accessing this functionality only when they are run
|
| 31 |
+
under the control of a debugger/profiler, without having to
|
| 32 |
+
recompile or change the application source code.
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
The official definition of this extension is available here:
|
| 36 |
+
http://www.opengl.org/registry/specs/GREMEDY/string_marker.txt
|
| 37 |
+
'''
|
| 38 |
+
from OpenGL import platform, constant, arrays
|
| 39 |
+
from OpenGL import extensions, wrapper
|
| 40 |
+
import ctypes
|
| 41 |
+
from OpenGL.raw.GL import _types, _glgets
|
| 42 |
+
from OpenGL.raw.GL.GREMEDY.string_marker import *
|
| 43 |
+
from OpenGL.raw.GL.GREMEDY.string_marker import _EXTENSION_NAME
|
| 44 |
+
|
| 45 |
+
def glInitStringMarkerGREMEDY():
|
| 46 |
+
'''Return boolean indicating whether this extension is available'''
|
| 47 |
+
from OpenGL import extensions
|
| 48 |
+
return extensions.hasGLExtension( _EXTENSION_NAME )
|
| 49 |
+
|
| 50 |
+
# INPUT glStringMarkerGREMEDY.string size not checked against len
|
| 51 |
+
glStringMarkerGREMEDY=wrapper.wrapper(glStringMarkerGREMEDY).setInputArraySize(
|
| 52 |
+
'string', None
|
| 53 |
+
)
|
| 54 |
+
### END AUTOGENERATED SECTION
|
vllm/lib/python3.10/site-packages/OpenGL/GL/INTEL/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
"""OpenGL Extensions"""
|
vllm/lib/python3.10/site-packages/OpenGL/GL/INTEL/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (194 Bytes). View file
|
|
|
vllm/lib/python3.10/site-packages/OpenGL/GL/INTEL/__pycache__/fragment_shader_ordering.cpython-310.pyc
ADDED
|
Binary file (2.27 kB). View file
|
|
|
vllm/lib/python3.10/site-packages/OpenGL/GL/INTEL/__pycache__/map_texture.cpython-310.pyc
ADDED
|
Binary file (1.93 kB). View file
|
|
|
vllm/lib/python3.10/site-packages/OpenGL/GL/INTEL/__pycache__/parallel_arrays.cpython-310.pyc
ADDED
|
Binary file (1.34 kB). View file
|
|
|
vllm/lib/python3.10/site-packages/OpenGL/GL/INTEL/__pycache__/performance_query.cpython-310.pyc
ADDED
|
Binary file (1.03 kB). View file
|
|
|
vllm/lib/python3.10/site-packages/OpenGL/GL/INTEL/fragment_shader_ordering.py
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'''OpenGL extension INTEL.fragment_shader_ordering
|
| 2 |
+
|
| 3 |
+
This module customises the behaviour of the
|
| 4 |
+
OpenGL.raw.GL.INTEL.fragment_shader_ordering to provide a more
|
| 5 |
+
Python-friendly API
|
| 6 |
+
|
| 7 |
+
Overview (from the spec)
|
| 8 |
+
|
| 9 |
+
Graphics devices may execute in parallel fragment shaders referring to the
|
| 10 |
+
same window xy coordinates. Framebuffer writes are guaranteed to be
|
| 11 |
+
processed in primitive rasterization order, but there is no order guarantee
|
| 12 |
+
for other instructions and image or buffer object accesses in
|
| 13 |
+
particular.
|
| 14 |
+
|
| 15 |
+
The extension introduces a new GLSL built-in function,
|
| 16 |
+
beginFragmentShaderOrderingINTEL(), which blocks execution of a fragment
|
| 17 |
+
shader invocation until invocations from previous primitives that map to
|
| 18 |
+
the same xy window coordinates (and same sample when per-sample shading
|
| 19 |
+
is active) complete their execution. All memory transactions from previous
|
| 20 |
+
fragment shader invocations are made visible to the fragment shader
|
| 21 |
+
invocation that called beginFragmentShaderOrderingINTEL() when the function
|
| 22 |
+
returns.
|
| 23 |
+
|
| 24 |
+
Including the following line in a shader can be used to control the
|
| 25 |
+
language features described in this extension:
|
| 26 |
+
|
| 27 |
+
#extension GL_INTEL_fragment_shader_ordering : <behavior>
|
| 28 |
+
|
| 29 |
+
where <behavior> is as specified in section 3.3.
|
| 30 |
+
|
| 31 |
+
New preprocessor #defines are added to the OpenGL Shading Language:
|
| 32 |
+
|
| 33 |
+
#define GL_INTEL_fragment_shader_ordering 1
|
| 34 |
+
|
| 35 |
+
The official definition of this extension is available here:
|
| 36 |
+
http://www.opengl.org/registry/specs/INTEL/fragment_shader_ordering.txt
|
| 37 |
+
'''
|
| 38 |
+
from OpenGL import platform, constant, arrays
|
| 39 |
+
from OpenGL import extensions, wrapper
|
| 40 |
+
import ctypes
|
| 41 |
+
from OpenGL.raw.GL import _types, _glgets
|
| 42 |
+
from OpenGL.raw.GL.INTEL.fragment_shader_ordering import *
|
| 43 |
+
from OpenGL.raw.GL.INTEL.fragment_shader_ordering import _EXTENSION_NAME
|
| 44 |
+
|
| 45 |
+
def glInitFragmentShaderOrderingINTEL():
|
| 46 |
+
'''Return boolean indicating whether this extension is available'''
|
| 47 |
+
from OpenGL import extensions
|
| 48 |
+
return extensions.hasGLExtension( _EXTENSION_NAME )
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
### END AUTOGENERATED SECTION
|
vllm/lib/python3.10/site-packages/OpenGL/GL/INTEL/map_texture.py
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'''OpenGL extension INTEL.map_texture
|
| 2 |
+
|
| 3 |
+
This module customises the behaviour of the
|
| 4 |
+
OpenGL.raw.GL.INTEL.map_texture to provide a more
|
| 5 |
+
Python-friendly API
|
| 6 |
+
|
| 7 |
+
Overview (from the spec)
|
| 8 |
+
Systems with integrated GPUs can share the same physical memory between CPU
|
| 9 |
+
and GPU. This feature, if exposed by API, can bring significant performance
|
| 10 |
+
benefits for graphics applications by reducing the complexity of
|
| 11 |
+
uploading/accessing texture contents. This extension enables CPU direct
|
| 12 |
+
access to the GPU memory holding textures.
|
| 13 |
+
|
| 14 |
+
The problem with texture memory directly exposed to clients is that
|
| 15 |
+
textures are often 'tiled'. Texels are kept in specific layout to improve
|
| 16 |
+
locality of reference and thus performance of texturing. This 'tiling'
|
| 17 |
+
is specific to particular hardware and would be thus difficult to use.
|
| 18 |
+
|
| 19 |
+
This extension allows to create textures with 'linear' layout which allows
|
| 20 |
+
for simplified access on user side (potentially sacrificing some
|
| 21 |
+
performance during texture sampling).
|
| 22 |
+
|
| 23 |
+
The official definition of this extension is available here:
|
| 24 |
+
http://www.opengl.org/registry/specs/INTEL/map_texture.txt
|
| 25 |
+
'''
|
| 26 |
+
from OpenGL import platform, constant, arrays
|
| 27 |
+
from OpenGL import extensions, wrapper
|
| 28 |
+
import ctypes
|
| 29 |
+
from OpenGL.raw.GL import _types, _glgets
|
| 30 |
+
from OpenGL.raw.GL.INTEL.map_texture import *
|
| 31 |
+
from OpenGL.raw.GL.INTEL.map_texture import _EXTENSION_NAME
|
| 32 |
+
|
| 33 |
+
def glInitMapTextureINTEL():
|
| 34 |
+
'''Return boolean indicating whether this extension is available'''
|
| 35 |
+
from OpenGL import extensions
|
| 36 |
+
return extensions.hasGLExtension( _EXTENSION_NAME )
|
| 37 |
+
|
| 38 |
+
glMapTexture2DINTEL=wrapper.wrapper(glMapTexture2DINTEL).setInputArraySize(
|
| 39 |
+
'stride', 1
|
| 40 |
+
).setInputArraySize(
|
| 41 |
+
'layout', 1
|
| 42 |
+
)
|
| 43 |
+
### END AUTOGENERATED SECTION
|
vllm/lib/python3.10/site-packages/OpenGL/GL/INTEL/parallel_arrays.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'''OpenGL extension INTEL.parallel_arrays
|
| 2 |
+
|
| 3 |
+
This module customises the behaviour of the
|
| 4 |
+
OpenGL.raw.GL.INTEL.parallel_arrays to provide a more
|
| 5 |
+
Python-friendly API
|
| 6 |
+
|
| 7 |
+
Overview (from the spec)
|
| 8 |
+
|
| 9 |
+
This extension adds the ability to format vertex arrays in a way that's
|
| 10 |
+
|
| 11 |
+
The official definition of this extension is available here:
|
| 12 |
+
http://www.opengl.org/registry/specs/INTEL/parallel_arrays.txt
|
| 13 |
+
'''
|
| 14 |
+
from OpenGL import platform, constant, arrays
|
| 15 |
+
from OpenGL import extensions, wrapper
|
| 16 |
+
import ctypes
|
| 17 |
+
from OpenGL.raw.GL import _types, _glgets
|
| 18 |
+
from OpenGL.raw.GL.INTEL.parallel_arrays import *
|
| 19 |
+
from OpenGL.raw.GL.INTEL.parallel_arrays import _EXTENSION_NAME
|
| 20 |
+
|
| 21 |
+
def glInitParallelArraysINTEL():
|
| 22 |
+
'''Return boolean indicating whether this extension is available'''
|
| 23 |
+
from OpenGL import extensions
|
| 24 |
+
return extensions.hasGLExtension( _EXTENSION_NAME )
|
| 25 |
+
|
| 26 |
+
glVertexPointervINTEL=wrapper.wrapper(glVertexPointervINTEL).setInputArraySize(
|
| 27 |
+
'pointer', 4
|
| 28 |
+
)
|
| 29 |
+
glNormalPointervINTEL=wrapper.wrapper(glNormalPointervINTEL).setInputArraySize(
|
| 30 |
+
'pointer', 4
|
| 31 |
+
)
|
| 32 |
+
glColorPointervINTEL=wrapper.wrapper(glColorPointervINTEL).setInputArraySize(
|
| 33 |
+
'pointer', 4
|
| 34 |
+
)
|
| 35 |
+
glTexCoordPointervINTEL=wrapper.wrapper(glTexCoordPointervINTEL).setInputArraySize(
|
| 36 |
+
'pointer', 4
|
| 37 |
+
)
|
| 38 |
+
### END AUTOGENERATED SECTION
|
vllm/lib/python3.10/site-packages/OpenGL/GL/INTEL/performance_query.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'''OpenGL extension INTEL.performance_query
|
| 2 |
+
|
| 3 |
+
This module customises the behaviour of the
|
| 4 |
+
OpenGL.raw.GL.INTEL.performance_query 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/INTEL/performance_query.txt
|
| 9 |
+
'''
|
| 10 |
+
from OpenGL import platform, constant, arrays
|
| 11 |
+
from OpenGL import extensions, wrapper
|
| 12 |
+
import ctypes
|
| 13 |
+
from OpenGL.raw.GL import _types, _glgets
|
| 14 |
+
from OpenGL.raw.GL.INTEL.performance_query import *
|
| 15 |
+
from OpenGL.raw.GL.INTEL.performance_query import _EXTENSION_NAME
|
| 16 |
+
|
| 17 |
+
def glInitPerformanceQueryINTEL():
|
| 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/GL/SGIX/blend_alpha_minmax.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'''OpenGL extension SGIX.blend_alpha_minmax
|
| 2 |
+
|
| 3 |
+
This module customises the behaviour of the
|
| 4 |
+
OpenGL.raw.GL.SGIX.blend_alpha_minmax to provide a more
|
| 5 |
+
Python-friendly API
|
| 6 |
+
|
| 7 |
+
Overview (from the spec)
|
| 8 |
+
|
| 9 |
+
Two additional blending equations are specified using the interface
|
| 10 |
+
defined by EXT_blend_minmax. These equations are similar to the
|
| 11 |
+
MIN_EXT and MAX_EXT blending equations, but the outcome for all four
|
| 12 |
+
color components is determined by a comparison of just the alpha
|
| 13 |
+
component's source and destination values. These equations are useful
|
| 14 |
+
in image processing and advanced shading algorithms.
|
| 15 |
+
|
| 16 |
+
The official definition of this extension is available here:
|
| 17 |
+
http://www.opengl.org/registry/specs/SGIX/blend_alpha_minmax.txt
|
| 18 |
+
'''
|
| 19 |
+
from OpenGL import platform, constant, arrays
|
| 20 |
+
from OpenGL import extensions, wrapper
|
| 21 |
+
import ctypes
|
| 22 |
+
from OpenGL.raw.GL import _types, _glgets
|
| 23 |
+
from OpenGL.raw.GL.SGIX.blend_alpha_minmax import *
|
| 24 |
+
from OpenGL.raw.GL.SGIX.blend_alpha_minmax import _EXTENSION_NAME
|
| 25 |
+
|
| 26 |
+
def glInitBlendAlphaMinmaxSGIX():
|
| 27 |
+
'''Return boolean indicating whether this extension is available'''
|
| 28 |
+
from OpenGL import extensions
|
| 29 |
+
return extensions.hasGLExtension( _EXTENSION_NAME )
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
### END AUTOGENERATED SECTION
|
vllm/lib/python3.10/site-packages/OpenGL/GL/SGIX/calligraphic_fragment.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'''OpenGL extension SGIX.calligraphic_fragment
|
| 2 |
+
|
| 3 |
+
This module customises the behaviour of the
|
| 4 |
+
OpenGL.raw.GL.SGIX.calligraphic_fragment 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/SGIX/calligraphic_fragment.txt
|
| 9 |
+
'''
|
| 10 |
+
from OpenGL import platform, constant, arrays
|
| 11 |
+
from OpenGL import extensions, wrapper
|
| 12 |
+
import ctypes
|
| 13 |
+
from OpenGL.raw.GL import _types, _glgets
|
| 14 |
+
from OpenGL.raw.GL.SGIX.calligraphic_fragment import *
|
| 15 |
+
from OpenGL.raw.GL.SGIX.calligraphic_fragment import _EXTENSION_NAME
|
| 16 |
+
|
| 17 |
+
def glInitCalligraphicFragmentSGIX():
|
| 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/GL/SGIX/depth_pass_instrument.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'''OpenGL extension SGIX.depth_pass_instrument
|
| 2 |
+
|
| 3 |
+
This module customises the behaviour of the
|
| 4 |
+
OpenGL.raw.GL.SGIX.depth_pass_instrument 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/SGIX/depth_pass_instrument.txt
|
| 9 |
+
'''
|
| 10 |
+
from OpenGL import platform, constant, arrays
|
| 11 |
+
from OpenGL import extensions, wrapper
|
| 12 |
+
import ctypes
|
| 13 |
+
from OpenGL.raw.GL import _types, _glgets
|
| 14 |
+
from OpenGL.raw.GL.SGIX.depth_pass_instrument import *
|
| 15 |
+
from OpenGL.raw.GL.SGIX.depth_pass_instrument import _EXTENSION_NAME
|
| 16 |
+
|
| 17 |
+
def glInitDepthPassInstrumentSGIX():
|
| 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/GL/SGIX/fog_offset.py
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'''OpenGL extension SGIX.fog_offset
|
| 2 |
+
|
| 3 |
+
This module customises the behaviour of the
|
| 4 |
+
OpenGL.raw.GL.SGIX.fog_offset to provide a more
|
| 5 |
+
Python-friendly API
|
| 6 |
+
|
| 7 |
+
Overview (from the spec)
|
| 8 |
+
|
| 9 |
+
This extension allows fragments to look brighter in a foggy
|
| 10 |
+
environment, by biasing the fragment eye-coordinate distance prior
|
| 11 |
+
to fog computation. A reference point in eye space (rx ry rz) and an offset
|
| 12 |
+
amount toward the viewpoint (f_o) are specified. When fog offset is
|
| 13 |
+
enabled, the offset amount will be subtracted from the fragment
|
| 14 |
+
distance, making objects appear less foggy.
|
| 15 |
+
|
| 16 |
+
If fog computation is done in screen-space coordinates under
|
| 17 |
+
perspective projection, the reference point is used in adjusting the
|
| 18 |
+
fog offset to be correct for fragments whose depth is close to that
|
| 19 |
+
point. The reference point should be redefined when it becomes too
|
| 20 |
+
far away from the primitives being drawn. Under orthographic
|
| 21 |
+
projection, or if fog computation is done in eye-space coordinates,
|
| 22 |
+
the reference point is ignored.
|
| 23 |
+
|
| 24 |
+
The official definition of this extension is available here:
|
| 25 |
+
http://www.opengl.org/registry/specs/SGIX/fog_offset.txt
|
| 26 |
+
'''
|
| 27 |
+
from OpenGL import platform, constant, arrays
|
| 28 |
+
from OpenGL import extensions, wrapper
|
| 29 |
+
import ctypes
|
| 30 |
+
from OpenGL.raw.GL import _types, _glgets
|
| 31 |
+
from OpenGL.raw.GL.SGIX.fog_offset import *
|
| 32 |
+
from OpenGL.raw.GL.SGIX.fog_offset import _EXTENSION_NAME
|
| 33 |
+
|
| 34 |
+
def glInitFogOffsetSGIX():
|
| 35 |
+
'''Return boolean indicating whether this extension is available'''
|
| 36 |
+
from OpenGL import extensions
|
| 37 |
+
return extensions.hasGLExtension( _EXTENSION_NAME )
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
### END AUTOGENERATED SECTION
|
vllm/lib/python3.10/site-packages/OpenGL/GL/SGIX/fragment_lighting.py
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'''OpenGL extension SGIX.fragment_lighting
|
| 2 |
+
|
| 3 |
+
This module customises the behaviour of the
|
| 4 |
+
OpenGL.raw.GL.SGIX.fragment_lighting 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/SGIX/fragment_lighting.txt
|
| 9 |
+
'''
|
| 10 |
+
from OpenGL import platform, constant, arrays
|
| 11 |
+
from OpenGL import extensions, wrapper
|
| 12 |
+
import ctypes
|
| 13 |
+
from OpenGL.raw.GL import _types, _glgets
|
| 14 |
+
from OpenGL.raw.GL.SGIX.fragment_lighting import *
|
| 15 |
+
from OpenGL.raw.GL.SGIX.fragment_lighting import _EXTENSION_NAME
|
| 16 |
+
|
| 17 |
+
def glInitFragmentLightingSGIX():
|
| 18 |
+
'''Return boolean indicating whether this extension is available'''
|
| 19 |
+
from OpenGL import extensions
|
| 20 |
+
return extensions.hasGLExtension( _EXTENSION_NAME )
|
| 21 |
+
|
| 22 |
+
# INPUT glFragmentLightfvSGIX.params size not checked against 'pname'
|
| 23 |
+
glFragmentLightfvSGIX=wrapper.wrapper(glFragmentLightfvSGIX).setInputArraySize(
|
| 24 |
+
'params', None
|
| 25 |
+
)
|
| 26 |
+
# INPUT glFragmentLightivSGIX.params size not checked against 'pname'
|
| 27 |
+
glFragmentLightivSGIX=wrapper.wrapper(glFragmentLightivSGIX).setInputArraySize(
|
| 28 |
+
'params', None
|
| 29 |
+
)
|
| 30 |
+
# INPUT glFragmentLightModelfvSGIX.params size not checked against 'pname'
|
| 31 |
+
glFragmentLightModelfvSGIX=wrapper.wrapper(glFragmentLightModelfvSGIX).setInputArraySize(
|
| 32 |
+
'params', None
|
| 33 |
+
)
|
| 34 |
+
# INPUT glFragmentLightModelivSGIX.params size not checked against 'pname'
|
| 35 |
+
glFragmentLightModelivSGIX=wrapper.wrapper(glFragmentLightModelivSGIX).setInputArraySize(
|
| 36 |
+
'params', None
|
| 37 |
+
)
|
| 38 |
+
# INPUT glFragmentMaterialfvSGIX.params size not checked against 'pname'
|
| 39 |
+
glFragmentMaterialfvSGIX=wrapper.wrapper(glFragmentMaterialfvSGIX).setInputArraySize(
|
| 40 |
+
'params', None
|
| 41 |
+
)
|
| 42 |
+
# INPUT glFragmentMaterialivSGIX.params size not checked against 'pname'
|
| 43 |
+
glFragmentMaterialivSGIX=wrapper.wrapper(glFragmentMaterialivSGIX).setInputArraySize(
|
| 44 |
+
'params', None
|
| 45 |
+
)
|
| 46 |
+
glGetFragmentLightfvSGIX=wrapper.wrapper(glGetFragmentLightfvSGIX).setOutput(
|
| 47 |
+
'params',size=_glgets._glget_size_mapping,pnameArg='pname',orPassIn=True
|
| 48 |
+
)
|
| 49 |
+
glGetFragmentLightivSGIX=wrapper.wrapper(glGetFragmentLightivSGIX).setOutput(
|
| 50 |
+
'params',size=_glgets._glget_size_mapping,pnameArg='pname',orPassIn=True
|
| 51 |
+
)
|
| 52 |
+
glGetFragmentMaterialfvSGIX=wrapper.wrapper(glGetFragmentMaterialfvSGIX).setOutput(
|
| 53 |
+
'params',size=_glgets._glget_size_mapping,pnameArg='pname',orPassIn=True
|
| 54 |
+
)
|
| 55 |
+
glGetFragmentMaterialivSGIX=wrapper.wrapper(glGetFragmentMaterialivSGIX).setOutput(
|
| 56 |
+
'params',size=_glgets._glget_size_mapping,pnameArg='pname',orPassIn=True
|
| 57 |
+
)
|
| 58 |
+
### END AUTOGENERATED SECTION
|
vllm/lib/python3.10/site-packages/OpenGL/GL/SGIX/igloo_interface.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'''OpenGL extension SGIX.igloo_interface
|
| 2 |
+
|
| 3 |
+
This module customises the behaviour of the
|
| 4 |
+
OpenGL.raw.GL.SGIX.igloo_interface 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/SGIX/igloo_interface.txt
|
| 9 |
+
'''
|
| 10 |
+
from OpenGL import platform, constant, arrays
|
| 11 |
+
from OpenGL import extensions, wrapper
|
| 12 |
+
import ctypes
|
| 13 |
+
from OpenGL.raw.GL import _types, _glgets
|
| 14 |
+
from OpenGL.raw.GL.SGIX.igloo_interface import *
|
| 15 |
+
from OpenGL.raw.GL.SGIX.igloo_interface import _EXTENSION_NAME
|
| 16 |
+
|
| 17 |
+
def glInitIglooInterfaceSGIX():
|
| 18 |
+
'''Return boolean indicating whether this extension is available'''
|
| 19 |
+
from OpenGL import extensions
|
| 20 |
+
return extensions.hasGLExtension( _EXTENSION_NAME )
|
| 21 |
+
|
| 22 |
+
# INPUT glIglooInterfaceSGIX.params size not checked against 'pname'
|
| 23 |
+
glIglooInterfaceSGIX=wrapper.wrapper(glIglooInterfaceSGIX).setInputArraySize(
|
| 24 |
+
'params', None
|
| 25 |
+
)
|
| 26 |
+
### END AUTOGENERATED SECTION
|
vllm/lib/python3.10/site-packages/OpenGL/GL/SGIX/instruments.py
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'''OpenGL extension SGIX.instruments
|
| 2 |
+
|
| 3 |
+
This module customises the behaviour of the
|
| 4 |
+
OpenGL.raw.GL.SGIX.instruments to provide a more
|
| 5 |
+
Python-friendly API
|
| 6 |
+
|
| 7 |
+
Overview (from the spec)
|
| 8 |
+
|
| 9 |
+
This extension allows the gathering and return of performance
|
| 10 |
+
measurements from within the graphics pipeline by adding
|
| 11 |
+
instrumentation.
|
| 12 |
+
|
| 13 |
+
There are two reasons to do this. The first is as a part of some
|
| 14 |
+
type of fixed-frame-rate load management scheme. If we know that
|
| 15 |
+
the pipeline is stalled or struggling to process the amount of
|
| 16 |
+
data we have given it so far, we can reduce the level of detail of
|
| 17 |
+
the remaining objects in the current frame or the next frame, or
|
| 18 |
+
adjust the framebuffer resolution for the next frame if we have a
|
| 19 |
+
video-zoom capability available. We can call this type of
|
| 20 |
+
instrumentation Load Monitoring.
|
| 21 |
+
|
| 22 |
+
The second is for performance tuning and debugging of an
|
| 23 |
+
application. It might tell us how many triangles were culled or
|
| 24 |
+
clipped before being rasterized. We can call this simply Tuning.
|
| 25 |
+
|
| 26 |
+
Load Monitoring requires that the instrumentation and the access
|
| 27 |
+
of the measurements be efficient, otherwise the instrumentation
|
| 28 |
+
itself will reduce performance more than any load-management
|
| 29 |
+
scheme could hope to offset. Tuning does not have the same
|
| 30 |
+
requirements.
|
| 31 |
+
|
| 32 |
+
The proposed extension adds a call to setup a measurements return
|
| 33 |
+
buffer, similar to FeedbackBuffer but with an asynchrounous
|
| 34 |
+
behavior to prevent filling the pipeline with NOP's while waiting
|
| 35 |
+
for the data to be returned.
|
| 36 |
+
|
| 37 |
+
Note that although the extension has been specified without any
|
| 38 |
+
particular instruments, defining either a device dependent or
|
| 39 |
+
device independent instrument should be as simple as introducing
|
| 40 |
+
an extension consisting primarily of a new enumerant to identify
|
| 41 |
+
the instrument.
|
| 42 |
+
|
| 43 |
+
The official definition of this extension is available here:
|
| 44 |
+
http://www.opengl.org/registry/specs/SGIX/instruments.txt
|
| 45 |
+
'''
|
| 46 |
+
from OpenGL import platform, constant, arrays
|
| 47 |
+
from OpenGL import extensions, wrapper
|
| 48 |
+
import ctypes
|
| 49 |
+
from OpenGL.raw.GL import _types, _glgets
|
| 50 |
+
from OpenGL.raw.GL.SGIX.instruments import *
|
| 51 |
+
from OpenGL.raw.GL.SGIX.instruments import _EXTENSION_NAME
|
| 52 |
+
|
| 53 |
+
def glInitInstrumentsSGIX():
|
| 54 |
+
'''Return boolean indicating whether this extension is available'''
|
| 55 |
+
from OpenGL import extensions
|
| 56 |
+
return extensions.hasGLExtension( _EXTENSION_NAME )
|
| 57 |
+
|
| 58 |
+
glInstrumentsBufferSGIX=wrapper.wrapper(glInstrumentsBufferSGIX).setOutput(
|
| 59 |
+
'buffer',size=lambda x:(x,),pnameArg='size',orPassIn=True
|
| 60 |
+
)
|
| 61 |
+
glPollInstrumentsSGIX=wrapper.wrapper(glPollInstrumentsSGIX).setOutput(
|
| 62 |
+
'marker_p',size=(1,),orPassIn=True
|
| 63 |
+
)
|
| 64 |
+
### END AUTOGENERATED SECTION
|
vllm/lib/python3.10/site-packages/OpenGL/GL/SGIX/interlace.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'''OpenGL extension SGIX.interlace
|
| 2 |
+
|
| 3 |
+
This module customises the behaviour of the
|
| 4 |
+
OpenGL.raw.GL.SGIX.interlace to provide a more
|
| 5 |
+
Python-friendly API
|
| 6 |
+
|
| 7 |
+
Overview (from the spec)
|
| 8 |
+
|
| 9 |
+
This extension provides a way to interlace rows of pixels when
|
| 10 |
+
rasterizing pixel rectangles, and loading texture images. In this
|
| 11 |
+
context, interlacing means skiping over rows of pixels or texels
|
| 12 |
+
in the destination. This is useful for dealing with video data
|
| 13 |
+
since a single frame of video is typically composed from two images
|
| 14 |
+
or fields: one image specifying the data for even rows of the frame
|
| 15 |
+
and the other image specifying the data for odd rows of the frame.
|
| 16 |
+
|
| 17 |
+
The official definition of this extension is available here:
|
| 18 |
+
http://www.opengl.org/registry/specs/SGIX/interlace.txt
|
| 19 |
+
'''
|
| 20 |
+
from OpenGL import platform, constant, arrays
|
| 21 |
+
from OpenGL import extensions, wrapper
|
| 22 |
+
import ctypes
|
| 23 |
+
from OpenGL.raw.GL import _types, _glgets
|
| 24 |
+
from OpenGL.raw.GL.SGIX.interlace import *
|
| 25 |
+
from OpenGL.raw.GL.SGIX.interlace import _EXTENSION_NAME
|
| 26 |
+
|
| 27 |
+
def glInitInterlaceSGIX():
|
| 28 |
+
'''Return boolean indicating whether this extension is available'''
|
| 29 |
+
from OpenGL import extensions
|
| 30 |
+
return extensions.hasGLExtension( _EXTENSION_NAME )
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
### END AUTOGENERATED SECTION
|
vllm/lib/python3.10/site-packages/OpenGL/GL/SGIX/ir_instrument1.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'''OpenGL extension SGIX.ir_instrument1
|
| 2 |
+
|
| 3 |
+
This module customises the behaviour of the
|
| 4 |
+
OpenGL.raw.GL.SGIX.ir_instrument1 to provide a more
|
| 5 |
+
Python-friendly API
|
| 6 |
+
|
| 7 |
+
Overview (from the spec)
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
The official definition of this extension is available here:
|
| 11 |
+
http://www.opengl.org/registry/specs/SGIX/ir_instrument1.txt
|
| 12 |
+
'''
|
| 13 |
+
from OpenGL import platform, constant, arrays
|
| 14 |
+
from OpenGL import extensions, wrapper
|
| 15 |
+
import ctypes
|
| 16 |
+
from OpenGL.raw.GL import _types, _glgets
|
| 17 |
+
from OpenGL.raw.GL.SGIX.ir_instrument1 import *
|
| 18 |
+
from OpenGL.raw.GL.SGIX.ir_instrument1 import _EXTENSION_NAME
|
| 19 |
+
|
| 20 |
+
def glInitIrInstrument1SGIX():
|
| 21 |
+
'''Return boolean indicating whether this extension is available'''
|
| 22 |
+
from OpenGL import extensions
|
| 23 |
+
return extensions.hasGLExtension( _EXTENSION_NAME )
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
### END AUTOGENERATED SECTION
|
vllm/lib/python3.10/site-packages/OpenGL/GL/SGIX/list_priority.py
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'''OpenGL extension SGIX.list_priority
|
| 2 |
+
|
| 3 |
+
This module customises the behaviour of the
|
| 4 |
+
OpenGL.raw.GL.SGIX.list_priority to provide a more
|
| 5 |
+
Python-friendly API
|
| 6 |
+
|
| 7 |
+
Overview (from the spec)
|
| 8 |
+
|
| 9 |
+
This extension provides a mechanism for specifying the relative
|
| 10 |
+
importance of display lists. This information can be used by
|
| 11 |
+
an OpenGL implementation to guide the placement of display
|
| 12 |
+
list data in a storage hierarchy.
|
| 13 |
+
|
| 14 |
+
The official definition of this extension is available here:
|
| 15 |
+
http://www.opengl.org/registry/specs/SGIX/list_priority.txt
|
| 16 |
+
'''
|
| 17 |
+
from OpenGL import platform, constant, arrays
|
| 18 |
+
from OpenGL import extensions, wrapper
|
| 19 |
+
import ctypes
|
| 20 |
+
from OpenGL.raw.GL import _types, _glgets
|
| 21 |
+
from OpenGL.raw.GL.SGIX.list_priority import *
|
| 22 |
+
from OpenGL.raw.GL.SGIX.list_priority import _EXTENSION_NAME
|
| 23 |
+
|
| 24 |
+
def glInitListPrioritySGIX():
|
| 25 |
+
'''Return boolean indicating whether this extension is available'''
|
| 26 |
+
from OpenGL import extensions
|
| 27 |
+
return extensions.hasGLExtension( _EXTENSION_NAME )
|
| 28 |
+
|
| 29 |
+
glGetListParameterfvSGIX=wrapper.wrapper(glGetListParameterfvSGIX).setOutput(
|
| 30 |
+
'params',size=_glgets._glget_size_mapping,pnameArg='pname',orPassIn=True
|
| 31 |
+
)
|
| 32 |
+
glGetListParameterivSGIX=wrapper.wrapper(glGetListParameterivSGIX).setOutput(
|
| 33 |
+
'params',size=_glgets._glget_size_mapping,pnameArg='pname',orPassIn=True
|
| 34 |
+
)
|
| 35 |
+
# INPUT glListParameterfvSGIX.params size not checked against 'pname'
|
| 36 |
+
glListParameterfvSGIX=wrapper.wrapper(glListParameterfvSGIX).setInputArraySize(
|
| 37 |
+
'params', None
|
| 38 |
+
)
|
| 39 |
+
# INPUT glListParameterivSGIX.params size not checked against 'pname'
|
| 40 |
+
glListParameterivSGIX=wrapper.wrapper(glListParameterivSGIX).setInputArraySize(
|
| 41 |
+
'params', None
|
| 42 |
+
)
|
| 43 |
+
### END AUTOGENERATED SECTION
|
vllm/lib/python3.10/site-packages/OpenGL/GL/SGIX/pixel_texture.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'''OpenGL extension SGIX.pixel_texture
|
| 2 |
+
|
| 3 |
+
This module customises the behaviour of the
|
| 4 |
+
OpenGL.raw.GL.SGIX.pixel_texture 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/SGIX/pixel_texture.txt
|
| 9 |
+
'''
|
| 10 |
+
from OpenGL import platform, constant, arrays
|
| 11 |
+
from OpenGL import extensions, wrapper
|
| 12 |
+
import ctypes
|
| 13 |
+
from OpenGL.raw.GL import _types, _glgets
|
| 14 |
+
from OpenGL.raw.GL.SGIX.pixel_texture import *
|
| 15 |
+
from OpenGL.raw.GL.SGIX.pixel_texture import _EXTENSION_NAME
|
| 16 |
+
|
| 17 |
+
def glInitPixelTextureSGIX():
|
| 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/GL/SGIX/pixel_tiles.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'''OpenGL extension SGIX.pixel_tiles
|
| 2 |
+
|
| 3 |
+
This module customises the behaviour of the
|
| 4 |
+
OpenGL.raw.GL.SGIX.pixel_tiles 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/SGIX/pixel_tiles.txt
|
| 9 |
+
'''
|
| 10 |
+
from OpenGL import platform, constant, arrays
|
| 11 |
+
from OpenGL import extensions, wrapper
|
| 12 |
+
import ctypes
|
| 13 |
+
from OpenGL.raw.GL import _types, _glgets
|
| 14 |
+
from OpenGL.raw.GL.SGIX.pixel_tiles import *
|
| 15 |
+
from OpenGL.raw.GL.SGIX.pixel_tiles import _EXTENSION_NAME
|
| 16 |
+
|
| 17 |
+
def glInitPixelTilesSGIX():
|
| 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/GL/SGIX/polynomial_ffd.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'''OpenGL extension SGIX.polynomial_ffd
|
| 2 |
+
|
| 3 |
+
This module customises the behaviour of the
|
| 4 |
+
OpenGL.raw.GL.SGIX.polynomial_ffd 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/SGIX/polynomial_ffd.txt
|
| 9 |
+
'''
|
| 10 |
+
from OpenGL import platform, constant, arrays
|
| 11 |
+
from OpenGL import extensions, wrapper
|
| 12 |
+
import ctypes
|
| 13 |
+
from OpenGL.raw.GL import _types, _glgets
|
| 14 |
+
from OpenGL.raw.GL.SGIX.polynomial_ffd import *
|
| 15 |
+
from OpenGL.raw.GL.SGIX.polynomial_ffd import _EXTENSION_NAME
|
| 16 |
+
|
| 17 |
+
def glInitPolynomialFfdSGIX():
|
| 18 |
+
'''Return boolean indicating whether this extension is available'''
|
| 19 |
+
from OpenGL import extensions
|
| 20 |
+
return extensions.hasGLExtension( _EXTENSION_NAME )
|
| 21 |
+
|
| 22 |
+
# INPUT glDeformationMap3dSGIX.points size not checked against 'target,ustride,uorder,vstride,vorder,wstride,worder'
|
| 23 |
+
glDeformationMap3dSGIX=wrapper.wrapper(glDeformationMap3dSGIX).setInputArraySize(
|
| 24 |
+
'points', None
|
| 25 |
+
)
|
| 26 |
+
# INPUT glDeformationMap3fSGIX.points size not checked against 'target,ustride,uorder,vstride,vorder,wstride,worder'
|
| 27 |
+
glDeformationMap3fSGIX=wrapper.wrapper(glDeformationMap3fSGIX).setInputArraySize(
|
| 28 |
+
'points', None
|
| 29 |
+
)
|
| 30 |
+
### END AUTOGENERATED SECTION
|
vllm/lib/python3.10/site-packages/OpenGL/GL/SGIX/reference_plane.py
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'''OpenGL extension SGIX.reference_plane
|
| 2 |
+
|
| 3 |
+
This module customises the behaviour of the
|
| 4 |
+
OpenGL.raw.GL.SGIX.reference_plane to provide a more
|
| 5 |
+
Python-friendly API
|
| 6 |
+
|
| 7 |
+
Overview (from the spec)
|
| 8 |
+
|
| 9 |
+
This extension allows a group of coplanar primitives to be rendered
|
| 10 |
+
without depth-buffering artifacts. This is accomplished by generating
|
| 11 |
+
the depth values for all the primitives from a single ``reference plane''
|
| 12 |
+
rather than from the primitives themselves. This ensures that all the
|
| 13 |
+
primitives in the group have exactly the same depth value at any given
|
| 14 |
+
sample point, no matter what imprecision may exist in the original
|
| 15 |
+
specifications of the primitives or in the GL's coordinate transformation
|
| 16 |
+
process.
|
| 17 |
+
|
| 18 |
+
The reference plane is defined by a four-component plane equation.
|
| 19 |
+
When glReferencePlaneSGIX is called, equation is transformed by the
|
| 20 |
+
transpose-adjoint of a matrix that is the complete object-coordinate
|
| 21 |
+
to clip-coordinate transformation. The resulting clip-coordinate
|
| 22 |
+
coefficients are transformed by the current viewport when the reference
|
| 23 |
+
plane is enabled.
|
| 24 |
+
|
| 25 |
+
The reference plane is enabled and disabled with glEnable and glDisable.
|
| 26 |
+
|
| 27 |
+
If the reference plane is enabled, a fragment (xf,yf,zf) will have a
|
| 28 |
+
new z coordinate generated from (xf,yf) by giving it the same z value
|
| 29 |
+
that the reference plane would have at (xf,yf).
|
| 30 |
+
|
| 31 |
+
The official definition of this extension is available here:
|
| 32 |
+
http://www.opengl.org/registry/specs/SGIX/reference_plane.txt
|
| 33 |
+
'''
|
| 34 |
+
from OpenGL import platform, constant, arrays
|
| 35 |
+
from OpenGL import extensions, wrapper
|
| 36 |
+
import ctypes
|
| 37 |
+
from OpenGL.raw.GL import _types, _glgets
|
| 38 |
+
from OpenGL.raw.GL.SGIX.reference_plane import *
|
| 39 |
+
from OpenGL.raw.GL.SGIX.reference_plane import _EXTENSION_NAME
|
| 40 |
+
|
| 41 |
+
def glInitReferencePlaneSGIX():
|
| 42 |
+
'''Return boolean indicating whether this extension is available'''
|
| 43 |
+
from OpenGL import extensions
|
| 44 |
+
return extensions.hasGLExtension( _EXTENSION_NAME )
|
| 45 |
+
|
| 46 |
+
glReferencePlaneSGIX=wrapper.wrapper(glReferencePlaneSGIX).setInputArraySize(
|
| 47 |
+
'equation', 4
|
| 48 |
+
)
|
| 49 |
+
### END AUTOGENERATED SECTION
|
vllm/lib/python3.10/site-packages/OpenGL/GL/SGIX/scalebias_hint.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'''OpenGL extension SGIX.scalebias_hint
|
| 2 |
+
|
| 3 |
+
This module customises the behaviour of the
|
| 4 |
+
OpenGL.raw.GL.SGIX.scalebias_hint 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/SGIX/scalebias_hint.txt
|
| 9 |
+
'''
|
| 10 |
+
from OpenGL import platform, constant, arrays
|
| 11 |
+
from OpenGL import extensions, wrapper
|
| 12 |
+
import ctypes
|
| 13 |
+
from OpenGL.raw.GL import _types, _glgets
|
| 14 |
+
from OpenGL.raw.GL.SGIX.scalebias_hint import *
|
| 15 |
+
from OpenGL.raw.GL.SGIX.scalebias_hint import _EXTENSION_NAME
|
| 16 |
+
|
| 17 |
+
def glInitScalebiasHintSGIX():
|
| 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/GL/SGIX/shadow.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'''OpenGL extension SGIX.shadow
|
| 2 |
+
|
| 3 |
+
This module customises the behaviour of the
|
| 4 |
+
OpenGL.raw.GL.SGIX.shadow to provide a more
|
| 5 |
+
Python-friendly API
|
| 6 |
+
|
| 7 |
+
Overview (from the spec)
|
| 8 |
+
|
| 9 |
+
This extension defines two new operations to be performed on texture
|
| 10 |
+
values before they are passed on to the filtering subsystem. These
|
| 11 |
+
operations perform either a <= or >= test on the value from texture
|
| 12 |
+
memory and the iterated R value, and return 1.0 or 0.0 if the test
|
| 13 |
+
passes or fails, respectively.
|
| 14 |
+
|
| 15 |
+
The official definition of this extension is available here:
|
| 16 |
+
http://www.opengl.org/registry/specs/SGIX/shadow.txt
|
| 17 |
+
'''
|
| 18 |
+
from OpenGL import platform, constant, arrays
|
| 19 |
+
from OpenGL import extensions, wrapper
|
| 20 |
+
import ctypes
|
| 21 |
+
from OpenGL.raw.GL import _types, _glgets
|
| 22 |
+
from OpenGL.raw.GL.SGIX.shadow import *
|
| 23 |
+
from OpenGL.raw.GL.SGIX.shadow import _EXTENSION_NAME
|
| 24 |
+
|
| 25 |
+
def glInitShadowSGIX():
|
| 26 |
+
'''Return boolean indicating whether this extension is available'''
|
| 27 |
+
from OpenGL import extensions
|
| 28 |
+
return extensions.hasGLExtension( _EXTENSION_NAME )
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
### END AUTOGENERATED SECTION
|
vllm/lib/python3.10/site-packages/OpenGL/GL/SGIX/subsample.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'''OpenGL extension SGIX.subsample
|
| 2 |
+
|
| 3 |
+
This module customises the behaviour of the
|
| 4 |
+
OpenGL.raw.GL.SGIX.subsample 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/SGIX/subsample.txt
|
| 9 |
+
'''
|
| 10 |
+
from OpenGL import platform, constant, arrays
|
| 11 |
+
from OpenGL import extensions, wrapper
|
| 12 |
+
import ctypes
|
| 13 |
+
from OpenGL.raw.GL import _types, _glgets
|
| 14 |
+
from OpenGL.raw.GL.SGIX.subsample import *
|
| 15 |
+
from OpenGL.raw.GL.SGIX.subsample import _EXTENSION_NAME
|
| 16 |
+
|
| 17 |
+
def glInitSubsampleSGIX():
|
| 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/GL/SGIX/tag_sample_buffer.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'''OpenGL extension SGIX.tag_sample_buffer
|
| 2 |
+
|
| 3 |
+
This module customises the behaviour of the
|
| 4 |
+
OpenGL.raw.GL.SGIX.tag_sample_buffer to provide a more
|
| 5 |
+
Python-friendly API
|
| 6 |
+
|
| 7 |
+
Overview (from the spec)
|
| 8 |
+
|
| 9 |
+
The extensions defines a special purpose fast multisample clear.
|
| 10 |
+
This clear can be used with some restrictions as a significantly
|
| 11 |
+
faster alternative to Clear(DEPTH_BUFFER_BIT).
|
| 12 |
+
|
| 13 |
+
The extension is based on the RealityEngine architecture and will
|
| 14 |
+
probably never be supported by any other architecture.
|
| 15 |
+
|
| 16 |
+
The official definition of this extension is available here:
|
| 17 |
+
http://www.opengl.org/registry/specs/SGIX/tag_sample_buffer.txt
|
| 18 |
+
'''
|
| 19 |
+
from OpenGL import platform, constant, arrays
|
| 20 |
+
from OpenGL import extensions, wrapper
|
| 21 |
+
import ctypes
|
| 22 |
+
from OpenGL.raw.GL import _types, _glgets
|
| 23 |
+
from OpenGL.raw.GL.SGIX.tag_sample_buffer import *
|
| 24 |
+
from OpenGL.raw.GL.SGIX.tag_sample_buffer import _EXTENSION_NAME
|
| 25 |
+
|
| 26 |
+
def glInitTagSampleBufferSGIX():
|
| 27 |
+
'''Return boolean indicating whether this extension is available'''
|
| 28 |
+
from OpenGL import extensions
|
| 29 |
+
return extensions.hasGLExtension( _EXTENSION_NAME )
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
### END AUTOGENERATED SECTION
|
vllm/lib/python3.10/site-packages/OpenGL/GL/SGIX/texture_coordinate_clamp.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'''OpenGL extension SGIX.texture_coordinate_clamp
|
| 2 |
+
|
| 3 |
+
This module customises the behaviour of the
|
| 4 |
+
OpenGL.raw.GL.SGIX.texture_coordinate_clamp to provide a more
|
| 5 |
+
Python-friendly API
|
| 6 |
+
|
| 7 |
+
Overview (from the spec)
|
| 8 |
+
|
| 9 |
+
This extension provides a mechanism to specify the maximum texture coordinate
|
| 10 |
+
clamping values. Standard OpenGL always clamps the upper bound to 1.0 when
|
| 11 |
+
the wrap mode is set to CLAMP. This mechanism can be used to guarantee
|
| 12 |
+
that non-existent texel data will not be accessed when the texture image has
|
| 13 |
+
dimensions that are not a power of 2.
|
| 14 |
+
|
| 15 |
+
The official definition of this extension is available here:
|
| 16 |
+
http://www.opengl.org/registry/specs/SGIX/texture_coordinate_clamp.txt
|
| 17 |
+
'''
|
| 18 |
+
from OpenGL import platform, constant, arrays
|
| 19 |
+
from OpenGL import extensions, wrapper
|
| 20 |
+
import ctypes
|
| 21 |
+
from OpenGL.raw.GL import _types, _glgets
|
| 22 |
+
from OpenGL.raw.GL.SGIX.texture_coordinate_clamp import *
|
| 23 |
+
from OpenGL.raw.GL.SGIX.texture_coordinate_clamp import _EXTENSION_NAME
|
| 24 |
+
|
| 25 |
+
def glInitTextureCoordinateClampSGIX():
|
| 26 |
+
'''Return boolean indicating whether this extension is available'''
|
| 27 |
+
from OpenGL import extensions
|
| 28 |
+
return extensions.hasGLExtension( _EXTENSION_NAME )
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
### END AUTOGENERATED SECTION
|
vllm/lib/python3.10/site-packages/OpenGL/GL/SGIX/texture_scale_bias.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'''OpenGL extension SGIX.texture_scale_bias
|
| 2 |
+
|
| 3 |
+
This module customises the behaviour of the
|
| 4 |
+
OpenGL.raw.GL.SGIX.texture_scale_bias to provide a more
|
| 5 |
+
Python-friendly API
|
| 6 |
+
|
| 7 |
+
Overview (from the spec)
|
| 8 |
+
|
| 9 |
+
This extension adds scale, bias, and clamp to [0, 1] operations to the
|
| 10 |
+
texture pipeline.
|
| 11 |
+
These operations are applied to the filtered result of a texture lookup,
|
| 12 |
+
before that result is used in the texture environment equations and
|
| 13 |
+
before the texture color lookup table of SGI_texture_color_table,
|
| 14 |
+
if that extension exists.
|
| 15 |
+
These operations are distinct from the scale, bias, and clamp operations
|
| 16 |
+
that appear in the SGI_color_table extension, which are used to
|
| 17 |
+
define a color lookup table.
|
| 18 |
+
|
| 19 |
+
Scale and bias operations on texels can be used to better utilize the
|
| 20 |
+
color resolution of a particular texture internal format (see EXT_texture).
|
| 21 |
+
|
| 22 |
+
The official definition of this extension is available here:
|
| 23 |
+
http://www.opengl.org/registry/specs/SGIX/texture_scale_bias.txt
|
| 24 |
+
'''
|
| 25 |
+
from OpenGL import platform, constant, arrays
|
| 26 |
+
from OpenGL import extensions, wrapper
|
| 27 |
+
import ctypes
|
| 28 |
+
from OpenGL.raw.GL import _types, _glgets
|
| 29 |
+
from OpenGL.raw.GL.SGIX.texture_scale_bias import *
|
| 30 |
+
from OpenGL.raw.GL.SGIX.texture_scale_bias import _EXTENSION_NAME
|
| 31 |
+
|
| 32 |
+
def glInitTextureScaleBiasSGIX():
|
| 33 |
+
'''Return boolean indicating whether this extension is available'''
|
| 34 |
+
from OpenGL import extensions
|
| 35 |
+
return extensions.hasGLExtension( _EXTENSION_NAME )
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
### END AUTOGENERATED SECTION
|
vllm/lib/python3.10/site-packages/OpenGL/GL/SGIX/vertex_preclip.py
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'''OpenGL extension SGIX.vertex_preclip
|
| 2 |
+
|
| 3 |
+
This module customises the behaviour of the
|
| 4 |
+
OpenGL.raw.GL.SGIX.vertex_preclip to provide a more
|
| 5 |
+
Python-friendly API
|
| 6 |
+
|
| 7 |
+
Overview (from the spec)
|
| 8 |
+
|
| 9 |
+
Certain graphics subsystems are capable of performing fast
|
| 10 |
+
2D viewport or, in some cases, 3D volume "scissoring" operations
|
| 11 |
+
within some coordinate range much faster that the host CPU could
|
| 12 |
+
re-tesselate clipped primitives.
|
| 13 |
+
|
| 14 |
+
This extension introduces the notion of an extended rasterizable view
|
| 15 |
+
volume that is an expansion of the clip-space view volume. This volume
|
| 16 |
+
is the space within which a particular graphics system is much more
|
| 17 |
+
efficient at rejecting fragments that lie outside the view volume than
|
| 18 |
+
it is at performing strict view volume clipping.
|
| 19 |
+
|
| 20 |
+
Clip-checking can be turned on or off through the glEnable/glDisable
|
| 21 |
+
mechanism, and can be further controlled by using glHint.
|
| 22 |
+
|
| 23 |
+
The official definition of this extension is available here:
|
| 24 |
+
http://www.opengl.org/registry/specs/SGIX/vertex_preclip.txt
|
| 25 |
+
'''
|
| 26 |
+
from OpenGL import platform, constant, arrays
|
| 27 |
+
from OpenGL import extensions, wrapper
|
| 28 |
+
import ctypes
|
| 29 |
+
from OpenGL.raw.GL import _types, _glgets
|
| 30 |
+
from OpenGL.raw.GL.SGIX.vertex_preclip import *
|
| 31 |
+
from OpenGL.raw.GL.SGIX.vertex_preclip import _EXTENSION_NAME
|
| 32 |
+
|
| 33 |
+
def glInitVertexPreclipSGIX():
|
| 34 |
+
'''Return boolean indicating whether this extension is available'''
|
| 35 |
+
from OpenGL import extensions
|
| 36 |
+
return extensions.hasGLExtension( _EXTENSION_NAME )
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
### END AUTOGENERATED SECTION
|
vllm/lib/python3.10/site-packages/OpenGL/GL/SGIX/ycrcb.py
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'''OpenGL extension SGIX.ycrcb
|
| 2 |
+
|
| 3 |
+
This module customises the behaviour of the
|
| 4 |
+
OpenGL.raw.GL.SGIX.ycrcb to provide a more
|
| 5 |
+
Python-friendly API
|
| 6 |
+
|
| 7 |
+
Overview (from the spec)
|
| 8 |
+
|
| 9 |
+
This extension provides a method for OpenGL to read and store
|
| 10 |
+
images that are defined in standard YCRCB 422 and 444 video formats.
|
| 11 |
+
As with the CYMK extension, conversion to RGBA takes place immediately
|
| 12 |
+
following the unpack pixel store, and preceding the pack pixel store
|
| 13 |
+
operations, and is only available on transfers to and from memory.
|
| 14 |
+
The algorithms that convert between YCRCB and RGBA are "black-box"
|
| 15 |
+
in nature, and left undefined by the extension.
|
| 16 |
+
|
| 17 |
+
Two new formats are added, YCRCB_422_SGIX and YCRCB_444_SGIX.
|
| 18 |
+
|
| 19 |
+
To handle the difference in sampling rate for 422 video, the pixel
|
| 20 |
+
storage operations treat YCRCB_422_SGIX as a 2 component format,
|
| 21 |
+
where the first component represents chroma, and the second luma.
|
| 22 |
+
The chroma component alternates between Cb and Cr values on
|
| 23 |
+
a per pixel basis. If the specified image <width> parameter is not
|
| 24 |
+
a multiple of 2, then fragments or texels that result from processing
|
| 25 |
+
the <width>th column of pixels will have undefined color value.
|
| 26 |
+
|
| 27 |
+
YCRCB_444_SGIX is defined as a 3 component format representing
|
| 28 |
+
the Cb, Y, and Cr values per pixel.
|
| 29 |
+
|
| 30 |
+
As with the CMYK extension, this extension doesn't preclude the
|
| 31 |
+
possiblity of other higher quality conversion methods.
|
| 32 |
+
|
| 33 |
+
The official definition of this extension is available here:
|
| 34 |
+
http://www.opengl.org/registry/specs/SGIX/ycrcb.txt
|
| 35 |
+
'''
|
| 36 |
+
from OpenGL import platform, constant, arrays
|
| 37 |
+
from OpenGL import extensions, wrapper
|
| 38 |
+
import ctypes
|
| 39 |
+
from OpenGL.raw.GL import _types, _glgets
|
| 40 |
+
from OpenGL.raw.GL.SGIX.ycrcb import *
|
| 41 |
+
from OpenGL.raw.GL.SGIX.ycrcb import _EXTENSION_NAME
|
| 42 |
+
|
| 43 |
+
def glInitYcrcbSGIX():
|
| 44 |
+
'''Return boolean indicating whether this extension is available'''
|
| 45 |
+
from OpenGL import extensions
|
| 46 |
+
return extensions.hasGLExtension( _EXTENSION_NAME )
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
### END AUTOGENERATED SECTION
|
| 50 |
+
from OpenGL import images as _i
|
| 51 |
+
_i.COMPONENT_COUNTS[ GL_YCRCB_422_SGIX ] = 1 # must be GL_UNSIGNED_BYTE
|
| 52 |
+
_i.COMPONENT_COUNTS[ GL_YCRCB_444_SGIX ] = 1 # must be GL_UNSIGNED_SHORT
|
vllm/lib/python3.10/site-packages/OpenGL/GL/SGIX/ycrcb_subsample.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
'''OpenGL extension SGIX.ycrcb_subsample
|
| 2 |
+
|
| 3 |
+
This module customises the behaviour of the
|
| 4 |
+
OpenGL.raw.GL.SGIX.ycrcb_subsample 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/SGIX/ycrcb_subsample.txt
|
| 9 |
+
'''
|
| 10 |
+
from OpenGL import platform, constant, arrays
|
| 11 |
+
from OpenGL import extensions, wrapper
|
| 12 |
+
import ctypes
|
| 13 |
+
from OpenGL.raw.GL import _types, _glgets
|
| 14 |
+
from OpenGL.raw.GL.SGIX.ycrcb_subsample import *
|
| 15 |
+
from OpenGL.raw.GL.SGIX.ycrcb_subsample import _EXTENSION_NAME
|
| 16 |
+
|
| 17 |
+
def glInitYcrcbSubsampleSGIX():
|
| 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/GL/__init__.py
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""OpenGL.GL, the core GL library and extensions to it"""
|
| 2 |
+
# early import of our modules to prevent import loops...
|
| 3 |
+
from OpenGL import error as _error
|
| 4 |
+
from OpenGL.GL.VERSION.GL_1_1 import *
|
| 5 |
+
from OpenGL.GL.pointers import *
|
| 6 |
+
from OpenGL.GL.images import *
|
| 7 |
+
|
| 8 |
+
from OpenGL.GL.exceptional import *
|
| 9 |
+
|
| 10 |
+
from OpenGL.GL.glget import *
|
| 11 |
+
|
| 12 |
+
from OpenGL.GL.VERSION.GL_1_2 import *
|
| 13 |
+
from OpenGL.GL.VERSION.GL_1_3 import *
|
| 14 |
+
from OpenGL.GL.VERSION.GL_1_4 import *
|
| 15 |
+
from OpenGL.GL.VERSION.GL_1_5 import *
|
| 16 |
+
from OpenGL.GL.VERSION.GL_2_0 import *
|
| 17 |
+
from OpenGL.GL.VERSION.GL_2_1 import *
|
| 18 |
+
from OpenGL.GL.VERSION.GL_3_0 import *
|
| 19 |
+
from OpenGL.GL.VERSION.GL_3_1 import *
|
| 20 |
+
from OpenGL.GL.VERSION.GL_3_2 import *
|
| 21 |
+
from OpenGL.GL.VERSION.GL_3_3 import *
|
| 22 |
+
from OpenGL.GL.VERSION.GL_4_0 import *
|
| 23 |
+
from OpenGL.GL.VERSION.GL_4_1 import *
|
| 24 |
+
from OpenGL.GL.VERSION.GL_4_2 import *
|
| 25 |
+
from OpenGL.GL.VERSION.GL_4_3 import *
|
| 26 |
+
from OpenGL.GL.VERSION.GL_4_4 import *
|
| 27 |
+
|
| 28 |
+
from OpenGL.error import *
|
| 29 |
+
GLerror = GLError
|
| 30 |
+
|
| 31 |
+
# Now the aliases...
|
| 32 |
+
glRotate = glRotated
|
| 33 |
+
glTranslate = glTranslated
|
| 34 |
+
glLight = glLightfv
|
| 35 |
+
glTexCoord = glTexCoord2d
|
| 36 |
+
glScale = glScaled
|
| 37 |
+
#glColor = glColor3f
|
| 38 |
+
glNormal = glNormal3d
|
| 39 |
+
|
| 40 |
+
glGetBoolean = glGetBooleanv
|
| 41 |
+
glGetDouble = glGetDoublev
|
| 42 |
+
glGetFloat = glGetFloatv
|
| 43 |
+
glGetInteger = glGetIntegerv
|
| 44 |
+
glGetPolygonStippleub = glGetPolygonStipple
|
| 45 |
+
|
| 46 |
+
from OpenGL.GL import vboimplementation as _core_implementation
|
| 47 |
+
from OpenGL.GL.ARB import vboimplementation as _arb_implementation
|
vllm/lib/python3.10/site-packages/OpenGL/GL/exceptional.py
ADDED
|
@@ -0,0 +1,278 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Exceptional cases that need some extra wrapping"""
|
| 2 |
+
from OpenGL import arrays
|
| 3 |
+
from OpenGL.arrays.arraydatatype import GLfloatArray, GLdoubleArray
|
| 4 |
+
from OpenGL.lazywrapper import lazy as _lazy
|
| 5 |
+
from OpenGL.GL.VERSION import GL_1_1 as full
|
| 6 |
+
from OpenGL.raw.GL import _types, _errors
|
| 7 |
+
from OpenGL._bytes import bytes
|
| 8 |
+
from OpenGL import _configflags
|
| 9 |
+
import ctypes
|
| 10 |
+
|
| 11 |
+
__all__ = [
|
| 12 |
+
'glBegin',
|
| 13 |
+
'glCallLists',
|
| 14 |
+
'glColor',
|
| 15 |
+
#'glColorTableParameterfv',
|
| 16 |
+
'glDeleteTextures',
|
| 17 |
+
'glEnd',
|
| 18 |
+
'glGenTextures',
|
| 19 |
+
'glMap1d',
|
| 20 |
+
'glMap1f',
|
| 21 |
+
'glMap2d',
|
| 22 |
+
'glMap2f',
|
| 23 |
+
'glMaterial',
|
| 24 |
+
'glRasterPos',
|
| 25 |
+
'glTexParameter',
|
| 26 |
+
'glVertex',
|
| 27 |
+
'glAreTexturesResident',
|
| 28 |
+
]
|
| 29 |
+
|
| 30 |
+
glRasterPosDispatch = {
|
| 31 |
+
2: full.glRasterPos2d,
|
| 32 |
+
3: full.glRasterPos3d,
|
| 33 |
+
4: full.glRasterPos4d,
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
if _configflags.ERROR_CHECKING:
|
| 37 |
+
@_lazy( full.glBegin )
|
| 38 |
+
def glBegin( baseFunction, mode ):
|
| 39 |
+
"""Begin GL geometry-definition mode, disable automatic error checking"""
|
| 40 |
+
_errors._error_checker.onBegin( )
|
| 41 |
+
return baseFunction( mode )
|
| 42 |
+
@_lazy( full.glEnd )
|
| 43 |
+
def glEnd( baseFunction ):
|
| 44 |
+
"""Finish GL geometry-definition mode, re-enable automatic error checking"""
|
| 45 |
+
_errors._error_checker.onEnd( )
|
| 46 |
+
return baseFunction( )
|
| 47 |
+
else:
|
| 48 |
+
glBegin = full.glBegin
|
| 49 |
+
glEnd = full.glEnd
|
| 50 |
+
|
| 51 |
+
@_lazy( full.glDeleteTextures )
|
| 52 |
+
def glDeleteTextures( baseFunction, array ):
|
| 53 |
+
"""Delete specified set of textures"""
|
| 54 |
+
ptr = arrays.GLuintArray.asArray( array )
|
| 55 |
+
size = arrays.GLuintArray.arraySize( ptr )
|
| 56 |
+
return baseFunction( size, ptr )
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
def glMap2( baseFunction, arrayType ):
|
| 60 |
+
def glMap2( target, u1, u2, v1, v2, points):
|
| 61 |
+
"""glMap2(target, u1, u2, v1, v2, points[][][]) -> None
|
| 62 |
+
|
| 63 |
+
This is a completely non-standard signature which doesn't allow for most
|
| 64 |
+
of the funky uses with strides and the like, but it has been like this for
|
| 65 |
+
a very long time...
|
| 66 |
+
"""
|
| 67 |
+
ptr = arrayType.asArray( points )
|
| 68 |
+
uorder,vorder,vstride = arrayType.dimensions( ptr )
|
| 69 |
+
ustride = vstride*vorder
|
| 70 |
+
return baseFunction(
|
| 71 |
+
target,
|
| 72 |
+
u1, u2,
|
| 73 |
+
ustride, uorder,
|
| 74 |
+
v1, v2,
|
| 75 |
+
vstride, vorder,
|
| 76 |
+
ptr
|
| 77 |
+
)
|
| 78 |
+
glMap2.__name__ = baseFunction.__name__
|
| 79 |
+
glMap2.baseFunction = baseFunction
|
| 80 |
+
return glMap2
|
| 81 |
+
glMap2d = glMap2( full.glMap2d, arrays.GLdoubleArray )
|
| 82 |
+
glMap2f = glMap2( full.glMap2f, arrays.GLfloatArray )
|
| 83 |
+
try:
|
| 84 |
+
del glMap2
|
| 85 |
+
except NameError as err:
|
| 86 |
+
pass
|
| 87 |
+
|
| 88 |
+
def glMap1( baseFunction, arrayType ):
|
| 89 |
+
def glMap1(target,u1,u2,points):
|
| 90 |
+
"""glMap1(target, u1, u2, points[][][]) -> None
|
| 91 |
+
|
| 92 |
+
This is a completely non-standard signature which doesn't allow for most
|
| 93 |
+
of the funky uses with strides and the like, but it has been like this for
|
| 94 |
+
a very long time...
|
| 95 |
+
"""
|
| 96 |
+
ptr = arrayType.asArray( points )
|
| 97 |
+
dims = arrayType.dimensions( ptr )
|
| 98 |
+
uorder = dims[0]
|
| 99 |
+
ustride = dims[1]
|
| 100 |
+
return baseFunction( target, u1,u2,ustride,uorder, ptr )
|
| 101 |
+
glMap1.__name__ == baseFunction.__name__
|
| 102 |
+
glMap1.baseFunction = baseFunction
|
| 103 |
+
return glMap1
|
| 104 |
+
glMap1d = glMap1( full.glMap1d, arrays.GLdoubleArray )
|
| 105 |
+
glMap1f = glMap1( full.glMap1f, arrays.GLfloatArray )
|
| 106 |
+
try:
|
| 107 |
+
del glMap1
|
| 108 |
+
except NameError as err:
|
| 109 |
+
pass
|
| 110 |
+
|
| 111 |
+
def glRasterPos( *args ):
|
| 112 |
+
"""Choose glRasterPosX based on number of args"""
|
| 113 |
+
if len(args) == 1:
|
| 114 |
+
# v form...
|
| 115 |
+
args = args[0]
|
| 116 |
+
function = glRasterPosDispatch[ len(args) ]
|
| 117 |
+
return function( *args )
|
| 118 |
+
|
| 119 |
+
glVertexDispatch = {
|
| 120 |
+
2: full.glVertex2d,
|
| 121 |
+
3: full.glVertex3d,
|
| 122 |
+
4: full.glVertex4d,
|
| 123 |
+
}
|
| 124 |
+
def glVertex( *args ):
|
| 125 |
+
"""Choose glVertexX based on number of args"""
|
| 126 |
+
if len(args) == 1:
|
| 127 |
+
# v form...
|
| 128 |
+
args = args[0]
|
| 129 |
+
return glVertexDispatch[ len(args) ]( *args )
|
| 130 |
+
|
| 131 |
+
@_lazy( full.glCallLists )
|
| 132 |
+
def glCallLists( baseFunction, lists, *args ):
|
| 133 |
+
"""glCallLists( bytes( lists ) or lists[] ) -> None
|
| 134 |
+
|
| 135 |
+
Restricted version of glCallLists, takes a string or a GLuint compatible
|
| 136 |
+
array data-type and passes into the base function.
|
| 137 |
+
"""
|
| 138 |
+
if not len(args):
|
| 139 |
+
if isinstance( lists, bytes ):
|
| 140 |
+
return baseFunction(
|
| 141 |
+
len(lists),
|
| 142 |
+
full.GL_UNSIGNED_BYTE,
|
| 143 |
+
ctypes.c_void_p(arrays.GLubyteArray.dataPointer( lists )),
|
| 144 |
+
)
|
| 145 |
+
ptr = arrays.GLuintArray.asArray( lists )
|
| 146 |
+
size = arrays.GLuintArray.arraySize( ptr )
|
| 147 |
+
return baseFunction(
|
| 148 |
+
size,
|
| 149 |
+
full.GL_UNSIGNED_INT,
|
| 150 |
+
ctypes.c_void_p( arrays.GLuintArray.dataPointer(ptr))
|
| 151 |
+
)
|
| 152 |
+
return baseFunction( lists, *args )
|
| 153 |
+
|
| 154 |
+
def glTexParameter( target, pname, parameter ):
|
| 155 |
+
"""Set a texture parameter, choose underlying call based on pname and parameter"""
|
| 156 |
+
if isinstance( parameter, float ):
|
| 157 |
+
return full.glTexParameterf( target, pname, parameter )
|
| 158 |
+
elif isinstance( parameter, int ):
|
| 159 |
+
return full.glTexParameteri( target, pname, parameter )
|
| 160 |
+
else:
|
| 161 |
+
value = GLfloatArray.asArray( parameter, full.GL_FLOAT )
|
| 162 |
+
return full.glTexParameterfv( target, pname, value )
|
| 163 |
+
|
| 164 |
+
@_lazy( full.glGenTextures )
|
| 165 |
+
def glGenTextures( baseFunction, count, textures=None ):
|
| 166 |
+
"""Generate count new texture names
|
| 167 |
+
|
| 168 |
+
Note: for compatibility with PyOpenGL 2.x and below,
|
| 169 |
+
a count of 1 will return a single integer, rather than
|
| 170 |
+
an array of integers.
|
| 171 |
+
"""
|
| 172 |
+
if count <= 0:
|
| 173 |
+
raise ValueError( """Can't generate 0 or fewer textures""" )
|
| 174 |
+
elif count == 1 and _configflags.SIZE_1_ARRAY_UNPACK:
|
| 175 |
+
# this traditionally returned a single int/long, so we'll continue to
|
| 176 |
+
# do so, even though it would be easier not to bother.
|
| 177 |
+
textures = _types.GLuint( 0 )
|
| 178 |
+
baseFunction( count, textures)
|
| 179 |
+
return textures.value
|
| 180 |
+
else:
|
| 181 |
+
textures = arrays.GLuintArray.zeros( (count,))
|
| 182 |
+
baseFunction( count, textures)
|
| 183 |
+
return textures
|
| 184 |
+
|
| 185 |
+
def glMaterial( faces, constant, *args ):
|
| 186 |
+
"""glMaterial -- convenience function to dispatch on argument type
|
| 187 |
+
|
| 188 |
+
If passed a single argument in args, calls:
|
| 189 |
+
glMaterialfv( faces, constant, args[0] )
|
| 190 |
+
else calls:
|
| 191 |
+
glMaterialf( faces, constant, *args )
|
| 192 |
+
"""
|
| 193 |
+
if len(args) == 1:
|
| 194 |
+
arg = GLfloatArray.asArray( args[0] )
|
| 195 |
+
if arg is None:
|
| 196 |
+
raise ValueError( """Null value in glMaterial: %s"""%(args,) )
|
| 197 |
+
return full.glMaterialfv( faces, constant, arg )
|
| 198 |
+
else:
|
| 199 |
+
return full.glMaterialf( faces, constant, *args )
|
| 200 |
+
|
| 201 |
+
glColorDispatch = {
|
| 202 |
+
3: full.glColor3fv,
|
| 203 |
+
4: full.glColor4fv,
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
def glColor( *args ):
|
| 207 |
+
"""glColor*f* -- convenience function to dispatch on argument type
|
| 208 |
+
|
| 209 |
+
dispatches to glColor3f, glColor2f, glColor4f, glColor3f, glColor2f, glColor4f
|
| 210 |
+
depending on the arguments passed...
|
| 211 |
+
"""
|
| 212 |
+
arglen = len(args)
|
| 213 |
+
if arglen == 1:
|
| 214 |
+
arg = arrays.GLfloatArray.asArray( args[0] )
|
| 215 |
+
function = glColorDispatch[arrays.GLfloatArray.arraySize( arg )]
|
| 216 |
+
return function( arg )
|
| 217 |
+
elif arglen == 2:
|
| 218 |
+
return full.glColor2d( *args )
|
| 219 |
+
elif arglen == 3:
|
| 220 |
+
return full.glColor3d( *args )
|
| 221 |
+
elif arglen == 4:
|
| 222 |
+
return full.glColor4d( *args )
|
| 223 |
+
else:
|
| 224 |
+
raise ValueError( """Don't know how to handle arguments: %s"""%(args,))
|
| 225 |
+
|
| 226 |
+
|
| 227 |
+
# Rectagle coordinates,
|
| 228 |
+
@_lazy( full.glAreTexturesResident )
|
| 229 |
+
def glAreTexturesResident( baseFunction, *args ):
|
| 230 |
+
"""Allow both Pythonic and C-style calls to glAreTexturesResident
|
| 231 |
+
|
| 232 |
+
glAreTexturesResident( arrays.GLuintArray( textures) )
|
| 233 |
+
|
| 234 |
+
or
|
| 235 |
+
|
| 236 |
+
glAreTexturesResident( int(n), arrays.GLuintArray( textures), arrays.GLuboolean( output) )
|
| 237 |
+
|
| 238 |
+
or
|
| 239 |
+
|
| 240 |
+
glAreTexturesResident( int(n), arrays.GLuintArray( textures) )
|
| 241 |
+
|
| 242 |
+
returns the output arrays.GLubooleanArray
|
| 243 |
+
"""
|
| 244 |
+
if len(args) == 1:
|
| 245 |
+
# Pythonic form...
|
| 246 |
+
textures = args[0]
|
| 247 |
+
textures = arrays.GLuintArray.asArray( textures )
|
| 248 |
+
n = arrays.GLuintArray.arraySize(textures)
|
| 249 |
+
output = arrays.GLbooleanArray.zeros( (n,))
|
| 250 |
+
elif len(args) == 2:
|
| 251 |
+
try:
|
| 252 |
+
n = int( args[0] )
|
| 253 |
+
except TypeError as err:
|
| 254 |
+
textures = args[0]
|
| 255 |
+
textures = arrays.GLuintArray.asArray( textures )
|
| 256 |
+
|
| 257 |
+
n = arrays.GLuintArray.arraySize(textures)
|
| 258 |
+
output = args[1]
|
| 259 |
+
output = arrays.GLbooleanArray.asArray( output )
|
| 260 |
+
else:
|
| 261 |
+
textures = args[1]
|
| 262 |
+
textures = arrays.GLuintArray.asArray( textures )
|
| 263 |
+
|
| 264 |
+
output = arrays.GLbooleanArray.zeros( (n,))
|
| 265 |
+
elif len(args) == 3:
|
| 266 |
+
n,textures,output = args
|
| 267 |
+
textures = arrays.GLuintArray.asArray( textures )
|
| 268 |
+
output = arrays.GLbooleanArray.asArray( output )
|
| 269 |
+
else:
|
| 270 |
+
raise TypeError( """Expected 1 to 3 arguments to glAreTexturesResident""" )
|
| 271 |
+
texturePtr = arrays.GLuintArray.typedPointer( textures )
|
| 272 |
+
outputPtr = arrays.GLbooleanArray.typedPointer( output )
|
| 273 |
+
result = baseFunction( n, texturePtr, outputPtr )
|
| 274 |
+
if result:
|
| 275 |
+
# weirdness of the C api, doesn't produce values if all are true
|
| 276 |
+
for i in range(len(output)):
|
| 277 |
+
output[i] = 1
|
| 278 |
+
return output
|
vllm/lib/python3.10/site-packages/OpenGL/GL/feedback.py
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Utility module to parse a Feedback buffer"""
|
| 2 |
+
from OpenGL import contextdata
|
| 3 |
+
from OpenGL.GL.VERSION import GL_1_1 as _simple
|
| 4 |
+
|
| 5 |
+
def parseFeedback( buffer, entryCount ):
|
| 6 |
+
"""Parse the feedback buffer into Python object records"""
|
| 7 |
+
bufferIndex = 0
|
| 8 |
+
result = []
|
| 9 |
+
getVertex = createGetVertex( )
|
| 10 |
+
while bufferIndex < entryCount:
|
| 11 |
+
token = int(buffer[bufferIndex])
|
| 12 |
+
bufferIndex += 1
|
| 13 |
+
if token in SINGLE_VERTEX_TOKENS:
|
| 14 |
+
vData, bufferIndex = getVertex( buffer, bufferIndex )
|
| 15 |
+
result.append( (SINGLE_VERTEX_TOKENS.get(token), Vertex(*vData)) )
|
| 16 |
+
elif token in DOUBLE_VERTEX_TOKENS:
|
| 17 |
+
vData, bufferIndex = getVertex( buffer, bufferIndex )
|
| 18 |
+
vData2, bufferIndex = getVertex( buffer, bufferIndex )
|
| 19 |
+
result.append( (
|
| 20 |
+
DOUBLE_VERTEX_TOKENS.get(token),
|
| 21 |
+
Vertex(*vData),
|
| 22 |
+
Vertex(*vData2),
|
| 23 |
+
) )
|
| 24 |
+
elif token == _simple.GL_PASS_THROUGH_TOKEN:
|
| 25 |
+
result.append( (_simple.GL_PASS_THROUGH_TOKEN, buffer[bufferIndex]))
|
| 26 |
+
bufferIndex += 1
|
| 27 |
+
elif token == _simple.GL_POLYGON_TOKEN:
|
| 28 |
+
temp = [_simple.GL_POLYGON_TOKEN]
|
| 29 |
+
count = int(buffer[bufferIndex])
|
| 30 |
+
bufferIndex += 1
|
| 31 |
+
for item in range(count):
|
| 32 |
+
vData,bufferIndex = getVertex( buffer, bufferIndex )
|
| 33 |
+
temp.append( Vertex(*vData))
|
| 34 |
+
result.append( tuple(temp))
|
| 35 |
+
else:
|
| 36 |
+
raise ValueError(
|
| 37 |
+
"""Unrecognised token %r in feedback stream"""%(token,)
|
| 38 |
+
)
|
| 39 |
+
return result
|
| 40 |
+
|
| 41 |
+
SINGLE_VERTEX_TOKENS = {
|
| 42 |
+
_simple.GL_BITMAP_TOKEN: _simple.GL_BITMAP_TOKEN,
|
| 43 |
+
_simple.GL_COPY_PIXEL_TOKEN: _simple.GL_COPY_PIXEL_TOKEN,
|
| 44 |
+
_simple.GL_DRAW_PIXEL_TOKEN: _simple.GL_DRAW_PIXEL_TOKEN,
|
| 45 |
+
_simple.GL_POINT_TOKEN: _simple.GL_POINT_TOKEN,
|
| 46 |
+
}
|
| 47 |
+
DOUBLE_VERTEX_TOKENS = {
|
| 48 |
+
_simple.GL_LINE_TOKEN: _simple.GL_LINE_TOKEN,
|
| 49 |
+
_simple.GL_LINE_RESET_TOKEN: _simple.GL_LINE_RESET_TOKEN,
|
| 50 |
+
}
|
| 51 |
+
class Vertex( object ):
|
| 52 |
+
"""Simplistic holder for vertex data from a feedback buffer"""
|
| 53 |
+
__slots__ = ('vertex','color','texture')
|
| 54 |
+
def __init__( self, vertex,color=None,texture=None):
|
| 55 |
+
"""Store values for access"""
|
| 56 |
+
self.vertex = vertex
|
| 57 |
+
self.color = color
|
| 58 |
+
self.texture = texture
|
| 59 |
+
def createGetVertex( ):
|
| 60 |
+
mode = contextdata.getValue( "GL_FEEDBACK_BUFFER_TYPE" )
|
| 61 |
+
indexMode = _simple.glGetBooleanv( _simple.GL_INDEX_MODE )
|
| 62 |
+
colorSize = [ 4,1 ][ int(indexMode) ]
|
| 63 |
+
if mode in (_simple.GL_2D,_simple.GL_3D):
|
| 64 |
+
if mode == _simple.GL_2D:
|
| 65 |
+
size = 2
|
| 66 |
+
else:
|
| 67 |
+
size = 3
|
| 68 |
+
def getVertex( buffer, bufferIndex ):
|
| 69 |
+
end = bufferIndex+size
|
| 70 |
+
return (buffer[bufferIndex:end],None,None),end
|
| 71 |
+
elif mode == _simple.GL_3D_COLOR:
|
| 72 |
+
def getVertex( buffer, bufferIndex ):
|
| 73 |
+
end = bufferIndex+3
|
| 74 |
+
colorEnd = end + colorSize
|
| 75 |
+
return (buffer[bufferIndex:end],buffer[end:colorEnd],None),colorEnd
|
| 76 |
+
else:
|
| 77 |
+
if mode == _simple.GL_3D_COLOR_TEXTURE:
|
| 78 |
+
size = 3
|
| 79 |
+
else:
|
| 80 |
+
size = 4
|
| 81 |
+
def getVertex( buffer, bufferIndex ):
|
| 82 |
+
end = bufferIndex+size
|
| 83 |
+
colorEnd = end + colorSize
|
| 84 |
+
textureEnd = colorEnd + 4
|
| 85 |
+
return (buffer[bufferIndex:end],buffer[end:colorEnd],buffer[colorEnd:textureEnd]),textureEnd
|
| 86 |
+
return getVertex
|
vllm/lib/python3.10/site-packages/OpenGL/GL/framebufferobjects.py
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Convenience API for using Frame Buffer Objects"""
|
| 2 |
+
from OpenGL.extensions import alternate
|
| 3 |
+
from OpenGL.GL.ARB.framebuffer_object import *
|
| 4 |
+
from OpenGL.GL.EXT.framebuffer_object import *
|
| 5 |
+
from OpenGL.GL.EXT.framebuffer_multisample import *
|
| 6 |
+
from OpenGL.GL.EXT.framebuffer_blit import *
|
| 7 |
+
|
| 8 |
+
glBindFramebuffer = alternate(glBindFramebuffer,glBindFramebufferEXT)
|
| 9 |
+
glBindRenderbuffer = alternate( glBindRenderbuffer, glBindRenderbufferEXT )
|
| 10 |
+
glCheckFramebufferStatus = alternate( glCheckFramebufferStatus, glCheckFramebufferStatusEXT )
|
| 11 |
+
glDeleteFramebuffers = alternate( glDeleteFramebuffers, glDeleteFramebuffersEXT )
|
| 12 |
+
glDeleteRenderbuffers = alternate( glDeleteRenderbuffers, glDeleteRenderbuffersEXT )
|
| 13 |
+
glFramebufferRenderbuffer = alternate( glFramebufferRenderbuffer, glFramebufferRenderbufferEXT )
|
| 14 |
+
glFramebufferTexture1D = alternate( glFramebufferTexture1D, glFramebufferTexture1DEXT )
|
| 15 |
+
glFramebufferTexture2D = alternate( glFramebufferTexture2D, glFramebufferTexture2DEXT )
|
| 16 |
+
glFramebufferTexture3D = alternate( glFramebufferTexture3D, glFramebufferTexture3DEXT )
|
| 17 |
+
glGenFramebuffers = alternate( glGenFramebuffers, glGenFramebuffersEXT )
|
| 18 |
+
glGenRenderbuffers = alternate( glGenRenderbuffers, glGenRenderbuffersEXT )
|
| 19 |
+
glGenerateMipmap = alternate( glGenerateMipmap, glGenerateMipmapEXT )
|
| 20 |
+
glGetFramebufferAttachmentParameteriv = alternate( glGetFramebufferAttachmentParameteriv, glGetFramebufferAttachmentParameterivEXT )
|
| 21 |
+
glGetRenderbufferParameteriv = alternate( glGetRenderbufferParameteriv, glGetRenderbufferParameterivEXT )
|
| 22 |
+
glIsFramebuffer = alternate( glIsFramebuffer, glIsFramebufferEXT )
|
| 23 |
+
glIsRenderbuffer = alternate( glIsRenderbuffer, glIsRenderbufferEXT )
|
| 24 |
+
glRenderbufferStorage = alternate( glRenderbufferStorage, glRenderbufferStorageEXT )
|
| 25 |
+
|
| 26 |
+
glBlitFramebuffer = alternate( glBlitFramebuffer, glBlitFramebufferEXT )
|
| 27 |
+
glRenderbufferStorageMultisample = alternate( glRenderbufferStorageMultisample, glRenderbufferStorageMultisampleEXT )
|
| 28 |
+
|
| 29 |
+
# this entry point is new to the ARB version of the extensions
|
| 30 |
+
#glFramebufferTextureLayer = alternate( glFramebufferTextureLayer, glFramebufferTextureLayerEXT )
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
def checkFramebufferStatus():
|
| 34 |
+
"""Utility method to check status and raise errors"""
|
| 35 |
+
status = glCheckFramebufferStatus( GL_FRAMEBUFFER )
|
| 36 |
+
if status == GL_FRAMEBUFFER_COMPLETE:
|
| 37 |
+
return True
|
| 38 |
+
from OpenGL.error import GLError
|
| 39 |
+
description = None
|
| 40 |
+
for error_constant in [
|
| 41 |
+
GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT,
|
| 42 |
+
GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT,
|
| 43 |
+
GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS,
|
| 44 |
+
GL_FRAMEBUFFER_INCOMPLETE_FORMATS,
|
| 45 |
+
GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER,
|
| 46 |
+
GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER,
|
| 47 |
+
GL_FRAMEBUFFER_UNSUPPORTED,
|
| 48 |
+
]:
|
| 49 |
+
if status == error_constant:
|
| 50 |
+
status = error_constant
|
| 51 |
+
description = str(status)
|
| 52 |
+
raise GLError(
|
| 53 |
+
err=status,
|
| 54 |
+
result=status,
|
| 55 |
+
baseOperation=glCheckFramebufferStatus,
|
| 56 |
+
description=description,
|
| 57 |
+
)
|
vllm/lib/python3.10/site-packages/OpenGL/GL/glget.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Implementation of the special "glGet" functions
|
| 2 |
+
|
| 3 |
+
For comparison, here's what a straightforward implementation looks like:
|
| 4 |
+
|
| 5 |
+
def glGetDoublev( pname ):
|
| 6 |
+
"Natural writing of glGetDoublev using standard ctypes"
|
| 7 |
+
output = c_double*sizes.get( pname )
|
| 8 |
+
result = output()
|
| 9 |
+
result = platform.PLATFORM.GL.glGetDoublev( pname, byref(result) )
|
| 10 |
+
return Numeric.array( result )
|
| 11 |
+
"""
|
| 12 |
+
from OpenGL import wrapper
|
| 13 |
+
from OpenGL.GL.VERSION import GL_1_1 as _simple
|
| 14 |
+
import ctypes
|
| 15 |
+
GLenum = ctypes.c_uint
|
| 16 |
+
GLsize = GLsizei = ctypes.c_int
|
| 17 |
+
|
| 18 |
+
__all__ = (
|
| 19 |
+
'glGetString',
|
| 20 |
+
)
|
| 21 |
+
|
| 22 |
+
glGetString = _simple.glGetString
|
| 23 |
+
glGetString.restype = ctypes.c_char_p
|
| 24 |
+
glGetString.__doc__ = """glGetString( constant ) -> Current string value"""
|
vllm/lib/python3.10/site-packages/OpenGL/GL/images.py
ADDED
|
@@ -0,0 +1,639 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Image-handling routines
|
| 2 |
+
|
| 3 |
+
### Unresolved:
|
| 4 |
+
|
| 5 |
+
Following methods are not yet resolved due to my not being sure how the
|
| 6 |
+
function should be wrapped:
|
| 7 |
+
|
| 8 |
+
glCompressedTexImage3D
|
| 9 |
+
glCompressedTexImage2D
|
| 10 |
+
glCompressedTexImage1D
|
| 11 |
+
glCompressedTexSubImage3D
|
| 12 |
+
glCompressedTexSubImage2D
|
| 13 |
+
glCompressedTexSubImage1D
|
| 14 |
+
"""
|
| 15 |
+
from OpenGL.raw.GL.VERSION import GL_1_1,GL_1_2, GL_3_0
|
| 16 |
+
from OpenGL import images, arrays, wrapper
|
| 17 |
+
from OpenGL._bytes import bytes,integer_types
|
| 18 |
+
from OpenGL.raw.GL import _types
|
| 19 |
+
import ctypes
|
| 20 |
+
|
| 21 |
+
def asInt( value ):
|
| 22 |
+
if isinstance( value, float ):
|
| 23 |
+
return int(round(value,0))
|
| 24 |
+
return value
|
| 25 |
+
|
| 26 |
+
## update the image tables with standard image types...
|
| 27 |
+
images.COMPONENT_COUNTS.update( {
|
| 28 |
+
GL_1_1.GL_BITMAP : 1, # must be GL_UNSIGNED_BYTE
|
| 29 |
+
|
| 30 |
+
GL_1_1.GL_RED : 1,
|
| 31 |
+
GL_1_1.GL_GREEN : 1,
|
| 32 |
+
GL_1_1.GL_BLUE : 1,
|
| 33 |
+
GL_1_1.GL_ALPHA : 1,
|
| 34 |
+
GL_3_0.GL_RED_INTEGER : 1,
|
| 35 |
+
GL_3_0.GL_GREEN_INTEGER : 1,
|
| 36 |
+
GL_3_0.GL_BLUE_INTEGER : 1,
|
| 37 |
+
GL_3_0.GL_ALPHA_INTEGER : 1,
|
| 38 |
+
GL_1_1.GL_LUMINANCE : 1,
|
| 39 |
+
GL_1_1.GL_LUMINANCE_ALPHA : 2,
|
| 40 |
+
GL_1_1.GL_COLOR_INDEX : 1,
|
| 41 |
+
GL_1_1.GL_STENCIL_INDEX : 1,
|
| 42 |
+
GL_1_1.GL_DEPTH_COMPONENT : 1,
|
| 43 |
+
|
| 44 |
+
GL_1_1.GL_RGB : 3,
|
| 45 |
+
GL_1_2.GL_BGR : 3,
|
| 46 |
+
GL_3_0.GL_RGB16F : 3,
|
| 47 |
+
GL_3_0.GL_RGB16I : 3,
|
| 48 |
+
GL_3_0.GL_RGB16UI : 3,
|
| 49 |
+
GL_3_0.GL_RGB32F : 3,
|
| 50 |
+
GL_3_0.GL_RGB32I : 3,
|
| 51 |
+
GL_3_0.GL_RGB32UI : 3,
|
| 52 |
+
GL_3_0.GL_RGB8I : 3,
|
| 53 |
+
GL_3_0.GL_RGB8UI : 3,
|
| 54 |
+
GL_3_0.GL_RGB9_E5 : 3,
|
| 55 |
+
GL_3_0.GL_RGB_INTEGER : 3,
|
| 56 |
+
|
| 57 |
+
GL_1_1.GL_RGBA : 4,
|
| 58 |
+
GL_1_2.GL_BGRA : 4,
|
| 59 |
+
GL_3_0.GL_RGBA16F : 4,
|
| 60 |
+
GL_3_0.GL_RGBA16I : 4,
|
| 61 |
+
GL_3_0.GL_RGBA16UI : 4,
|
| 62 |
+
GL_3_0.GL_RGBA32F : 4,
|
| 63 |
+
GL_3_0.GL_RGBA32I : 4,
|
| 64 |
+
GL_3_0.GL_RGBA32UI : 4,
|
| 65 |
+
GL_3_0.GL_RGBA8I : 4,
|
| 66 |
+
GL_3_0.GL_RGBA8UI : 4,
|
| 67 |
+
GL_3_0.GL_RGBA_INTEGER : 4,
|
| 68 |
+
} )
|
| 69 |
+
|
| 70 |
+
images.TYPE_TO_ARRAYTYPE.update( {
|
| 71 |
+
GL_1_2.GL_UNSIGNED_BYTE_3_3_2 : GL_1_1.GL_UNSIGNED_BYTE,
|
| 72 |
+
GL_1_2.GL_UNSIGNED_BYTE_2_3_3_REV : GL_1_1.GL_UNSIGNED_BYTE,
|
| 73 |
+
GL_1_2.GL_UNSIGNED_SHORT_4_4_4_4 : GL_1_1.GL_UNSIGNED_SHORT,
|
| 74 |
+
GL_1_2.GL_UNSIGNED_SHORT_4_4_4_4_REV : GL_1_1.GL_UNSIGNED_SHORT,
|
| 75 |
+
GL_1_2.GL_UNSIGNED_SHORT_5_5_5_1 : GL_1_1.GL_UNSIGNED_SHORT,
|
| 76 |
+
GL_1_2.GL_UNSIGNED_SHORT_1_5_5_5_REV : GL_1_1.GL_UNSIGNED_SHORT,
|
| 77 |
+
GL_1_2.GL_UNSIGNED_SHORT_5_6_5 : GL_1_1.GL_UNSIGNED_SHORT,
|
| 78 |
+
GL_1_2.GL_UNSIGNED_SHORT_5_6_5_REV : GL_1_1.GL_UNSIGNED_SHORT,
|
| 79 |
+
GL_1_2.GL_UNSIGNED_INT_8_8_8_8 : GL_1_1.GL_UNSIGNED_INT,
|
| 80 |
+
GL_1_2.GL_UNSIGNED_INT_8_8_8_8_REV : GL_1_1.GL_UNSIGNED_INT,
|
| 81 |
+
GL_1_2.GL_UNSIGNED_INT_10_10_10_2 : GL_1_1.GL_UNSIGNED_INT,
|
| 82 |
+
GL_1_2.GL_UNSIGNED_INT_2_10_10_10_REV : GL_1_1.GL_UNSIGNED_INT,
|
| 83 |
+
GL_1_1.GL_UNSIGNED_BYTE : GL_1_1.GL_UNSIGNED_BYTE,
|
| 84 |
+
GL_1_1.GL_BYTE: GL_1_1.GL_BYTE,
|
| 85 |
+
GL_1_1.GL_UNSIGNED_SHORT : GL_1_1.GL_UNSIGNED_SHORT,
|
| 86 |
+
GL_1_1.GL_SHORT : GL_1_1.GL_SHORT,
|
| 87 |
+
GL_1_1.GL_UNSIGNED_INT : GL_1_1.GL_UNSIGNED_INT,
|
| 88 |
+
GL_1_1.GL_INT : GL_1_1.GL_INT,
|
| 89 |
+
GL_1_1.GL_FLOAT : GL_1_1.GL_FLOAT,
|
| 90 |
+
GL_1_1.GL_DOUBLE : GL_1_1.GL_DOUBLE,
|
| 91 |
+
GL_1_1.GL_BITMAP : GL_1_1.GL_UNSIGNED_BYTE,
|
| 92 |
+
} )
|
| 93 |
+
images.TIGHT_PACK_FORMATS.update({
|
| 94 |
+
GL_1_2.GL_UNSIGNED_BYTE_3_3_2 : 3,
|
| 95 |
+
GL_1_2.GL_UNSIGNED_BYTE_2_3_3_REV : 3,
|
| 96 |
+
GL_1_2.GL_UNSIGNED_SHORT_4_4_4_4 : 4,
|
| 97 |
+
GL_1_2.GL_UNSIGNED_SHORT_4_4_4_4_REV : 4,
|
| 98 |
+
GL_1_2.GL_UNSIGNED_SHORT_5_5_5_1 : 4,
|
| 99 |
+
GL_1_2.GL_UNSIGNED_SHORT_1_5_5_5_REV : 4,
|
| 100 |
+
GL_1_2.GL_UNSIGNED_SHORT_5_6_5 : 3,
|
| 101 |
+
GL_1_2.GL_UNSIGNED_SHORT_5_6_5_REV : 3,
|
| 102 |
+
GL_1_2.GL_UNSIGNED_INT_8_8_8_8 : 4,
|
| 103 |
+
GL_1_2.GL_UNSIGNED_INT_8_8_8_8_REV : 4,
|
| 104 |
+
GL_1_2.GL_UNSIGNED_INT_10_10_10_2 : 4,
|
| 105 |
+
GL_1_2.GL_UNSIGNED_INT_2_10_10_10_REV : 4,
|
| 106 |
+
GL_1_1.GL_BITMAP: 8, # single bits, 8 of them...
|
| 107 |
+
})
|
| 108 |
+
|
| 109 |
+
images.RANK_PACKINGS.update( {
|
| 110 |
+
4: [
|
| 111 |
+
# Note the sgis parameters are skipped here unless you import
|
| 112 |
+
# the sgis texture4D extension...
|
| 113 |
+
(GL_1_1.glPixelStorei,GL_1_1.GL_PACK_ALIGNMENT, 1),
|
| 114 |
+
],
|
| 115 |
+
3: [
|
| 116 |
+
(GL_1_1.glPixelStorei,GL_1_2.GL_PACK_SKIP_IMAGES, 0),
|
| 117 |
+
(GL_1_1.glPixelStorei,GL_1_2.GL_PACK_IMAGE_HEIGHT, 0),
|
| 118 |
+
(GL_1_1.glPixelStorei,GL_1_1.GL_PACK_ALIGNMENT, 1),
|
| 119 |
+
],
|
| 120 |
+
2: [
|
| 121 |
+
(GL_1_1.glPixelStorei,GL_1_1.GL_PACK_ROW_LENGTH, 0),
|
| 122 |
+
(GL_1_1.glPixelStorei,GL_1_1.GL_PACK_SKIP_ROWS, 0),
|
| 123 |
+
(GL_1_1.glPixelStorei,GL_1_1.GL_PACK_ALIGNMENT, 1),
|
| 124 |
+
],
|
| 125 |
+
1: [
|
| 126 |
+
(GL_1_1.glPixelStorei,GL_1_1.GL_PACK_SKIP_PIXELS, 0),
|
| 127 |
+
(GL_1_1.glPixelStorei,GL_1_1.GL_PACK_ALIGNMENT, 1),
|
| 128 |
+
],
|
| 129 |
+
} )
|
| 130 |
+
|
| 131 |
+
|
| 132 |
+
__all__ = (
|
| 133 |
+
'glReadPixels',
|
| 134 |
+
'glReadPixelsb',
|
| 135 |
+
'glReadPixelsd',
|
| 136 |
+
'glReadPixelsf',
|
| 137 |
+
'glReadPixelsi',
|
| 138 |
+
'glReadPixelss',
|
| 139 |
+
'glReadPixelsub',
|
| 140 |
+
'glReadPixelsui',
|
| 141 |
+
'glReadPixelsus',
|
| 142 |
+
|
| 143 |
+
'glGetTexImage',
|
| 144 |
+
|
| 145 |
+
'glDrawPixels',
|
| 146 |
+
'glDrawPixelsb',
|
| 147 |
+
'glDrawPixelsf',
|
| 148 |
+
'glDrawPixelsi',
|
| 149 |
+
'glDrawPixelss',
|
| 150 |
+
'glDrawPixelsub',
|
| 151 |
+
'glDrawPixelsui',
|
| 152 |
+
'glDrawPixelsus',
|
| 153 |
+
|
| 154 |
+
|
| 155 |
+
'glTexSubImage2D',
|
| 156 |
+
'glTexSubImage1D',
|
| 157 |
+
#'glTexSubImage3D',
|
| 158 |
+
|
| 159 |
+
'glTexImage1D',
|
| 160 |
+
'glTexImage2D',
|
| 161 |
+
#'glTexImage3D',
|
| 162 |
+
|
| 163 |
+
'glGetTexImageb',
|
| 164 |
+
'glGetTexImaged',
|
| 165 |
+
'glGetTexImagef',
|
| 166 |
+
'glGetTexImagei',
|
| 167 |
+
'glGetTexImages',
|
| 168 |
+
'glGetTexImageub',
|
| 169 |
+
'glGetTexImageui',
|
| 170 |
+
'glGetTexImageus',
|
| 171 |
+
'glTexImage1Db',
|
| 172 |
+
'glTexImage2Db',
|
| 173 |
+
#'glTexImage3Db',
|
| 174 |
+
'glTexSubImage1Db',
|
| 175 |
+
'glTexSubImage2Db',
|
| 176 |
+
#'glTexSubImage3Db',
|
| 177 |
+
'glTexImage1Df',
|
| 178 |
+
'glTexImage2Df',
|
| 179 |
+
#'glTexImage3Df',
|
| 180 |
+
'glTexSubImage1Df',
|
| 181 |
+
'glTexSubImage2Df',
|
| 182 |
+
#'glTexSubImage3Df',
|
| 183 |
+
'glTexImage1Di',
|
| 184 |
+
'glTexImage2Di',
|
| 185 |
+
#'glTexImage3Di',
|
| 186 |
+
'glTexSubImage1Di',
|
| 187 |
+
'glTexSubImage2Di',
|
| 188 |
+
#'glTexSubImage3Di',
|
| 189 |
+
'glTexImage1Ds',
|
| 190 |
+
'glTexImage2Ds',
|
| 191 |
+
#'glTexImage3Ds',
|
| 192 |
+
'glTexSubImage1Ds',
|
| 193 |
+
'glTexSubImage2Ds',
|
| 194 |
+
#'glTexSubImage3Ds',
|
| 195 |
+
'glTexImage1Dub',
|
| 196 |
+
'glTexImage2Dub',
|
| 197 |
+
#'glTexImage3Dub',
|
| 198 |
+
'glTexSubImage1Dub',
|
| 199 |
+
'glTexSubImage2Dub',
|
| 200 |
+
#'glTexSubImage3Dub',
|
| 201 |
+
'glTexImage1Dui',
|
| 202 |
+
'glTexImage2Dui',
|
| 203 |
+
#'glTexImage3Dui',
|
| 204 |
+
'glTexSubImage1Dui',
|
| 205 |
+
'glTexSubImage2Dui',
|
| 206 |
+
#'glTexSubImage3Dui',
|
| 207 |
+
'glTexImage1Dus',
|
| 208 |
+
'glTexImage2Dus',
|
| 209 |
+
#'glTexImage3Dus',
|
| 210 |
+
'glTexSubImage1Dus',
|
| 211 |
+
'glTexSubImage2Dus',
|
| 212 |
+
#'glTexSubImage3Dus',
|
| 213 |
+
|
| 214 |
+
#'glColorTable',
|
| 215 |
+
#'glGetColorTable',
|
| 216 |
+
#'glColorSubTable',
|
| 217 |
+
|
| 218 |
+
#'glConvolutionFilter1D',
|
| 219 |
+
#'glConvolutionFilter2D',
|
| 220 |
+
#'glGetConvolutionFilter',
|
| 221 |
+
#'glSeparableFilter2D',
|
| 222 |
+
#'glGetSeparableFilter',
|
| 223 |
+
|
| 224 |
+
#'glGetMinmax',
|
| 225 |
+
)
|
| 226 |
+
|
| 227 |
+
def _get_texture_level_dims(target,level):
|
| 228 |
+
"""Retrieve texture dims for given level and target"""
|
| 229 |
+
dims = []
|
| 230 |
+
dim = _types.GLuint()
|
| 231 |
+
GL_1_1.glGetTexLevelParameteriv( target, level, GL_1_1.GL_TEXTURE_WIDTH, dim )
|
| 232 |
+
dims = [dim.value]
|
| 233 |
+
if target != GL_1_1.GL_TEXTURE_1D:
|
| 234 |
+
GL_1_1.glGetTexLevelParameteriv( target, level, GL_1_1.GL_TEXTURE_HEIGHT, dim )
|
| 235 |
+
dims.append( dim.value )
|
| 236 |
+
if target != GL_1_1.GL_TEXTURE_2D:
|
| 237 |
+
GL_1_1.glGetTexLevelParameteriv( target, level, GL_1_1.GL_TEXTURE_DEPTH, dim )
|
| 238 |
+
dims.append( dim.value )
|
| 239 |
+
return dims
|
| 240 |
+
|
| 241 |
+
for suffix,type in [
|
| 242 |
+
('b',GL_1_1.GL_BYTE),
|
| 243 |
+
('d',GL_1_1.GL_DOUBLE),
|
| 244 |
+
('f',GL_1_1.GL_FLOAT),
|
| 245 |
+
('i',GL_1_1.GL_INT),
|
| 246 |
+
('s',GL_1_1.GL_SHORT),
|
| 247 |
+
('ub',GL_1_1.GL_UNSIGNED_BYTE),
|
| 248 |
+
('ui',GL_1_1.GL_UNSIGNED_INT),
|
| 249 |
+
('us',GL_1_1.GL_UNSIGNED_SHORT),
|
| 250 |
+
]:
|
| 251 |
+
def glReadPixels( x,y,width,height,format,type=type, array=None, outputType=bytes ):
|
| 252 |
+
"""Read specified pixels from the current display buffer
|
| 253 |
+
|
| 254 |
+
This typed version returns data in your specified default
|
| 255 |
+
array data-type format, or in the passed array, which will
|
| 256 |
+
be converted to the array-type required by the format.
|
| 257 |
+
"""
|
| 258 |
+
x,y,width,height = asInt(x),asInt(y),asInt(width),asInt(height)
|
| 259 |
+
arrayType = arrays.GL_CONSTANT_TO_ARRAY_TYPE[ images.TYPE_TO_ARRAYTYPE.get(type,type) ]
|
| 260 |
+
|
| 261 |
+
if array is None:
|
| 262 |
+
array = imageData = images.SetupPixelRead( format, (width,height), type )
|
| 263 |
+
owned = True
|
| 264 |
+
else:
|
| 265 |
+
if isinstance( array, integer_types):
|
| 266 |
+
imageData = ctypes.c_void_p( array )
|
| 267 |
+
else:
|
| 268 |
+
array = arrayType.asArray( array )
|
| 269 |
+
imageData = arrayType.voidDataPointer( array )
|
| 270 |
+
owned = False
|
| 271 |
+
GL_1_1.glReadPixels(
|
| 272 |
+
x,y,
|
| 273 |
+
width, height,
|
| 274 |
+
format,type,
|
| 275 |
+
imageData
|
| 276 |
+
)
|
| 277 |
+
if owned and outputType is bytes:
|
| 278 |
+
return images.returnFormat( array, type )
|
| 279 |
+
else:
|
| 280 |
+
return array
|
| 281 |
+
globals()["glReadPixels%s"%(suffix,)] = glReadPixels
|
| 282 |
+
def glGetTexImage( target, level,format,type=type, array=None, outputType=bytes ):
|
| 283 |
+
"""Get a texture-level as an image
|
| 284 |
+
|
| 285 |
+
target -- enum constant for the texture engine to be read
|
| 286 |
+
level -- the mip-map level to read
|
| 287 |
+
format -- image format to read out the data
|
| 288 |
+
type -- data-type into which to read the data
|
| 289 |
+
array -- optional array/offset into which to store the value
|
| 290 |
+
|
| 291 |
+
outputType -- default (bytes) provides string output of the
|
| 292 |
+
results iff OpenGL.UNSIGNED_BYTE_IMAGES_AS_STRING is True
|
| 293 |
+
and type == GL_UNSIGNED_BYTE. Any other value will cause
|
| 294 |
+
output in the default array output format.
|
| 295 |
+
|
| 296 |
+
returns the pixel data array in the format defined by the
|
| 297 |
+
format, type and outputType
|
| 298 |
+
"""
|
| 299 |
+
arrayType = arrays.GL_CONSTANT_TO_ARRAY_TYPE[ images.TYPE_TO_ARRAYTYPE.get(type,type) ]
|
| 300 |
+
if array is None:
|
| 301 |
+
dims = _get_texture_level_dims(target,level)
|
| 302 |
+
array = imageData = images.SetupPixelRead( format, tuple(dims), type )
|
| 303 |
+
owned = True
|
| 304 |
+
else:
|
| 305 |
+
if isinstance( array, integer_types):
|
| 306 |
+
imageData = ctypes.c_void_p( array )
|
| 307 |
+
else:
|
| 308 |
+
array = arrayType.asArray( array )
|
| 309 |
+
imageData = arrayType.voidDataPointer( array )
|
| 310 |
+
owned = False
|
| 311 |
+
GL_1_1.glGetTexImage(
|
| 312 |
+
target, level, format, type, imageData
|
| 313 |
+
)
|
| 314 |
+
if owned and outputType is bytes:
|
| 315 |
+
return images.returnFormat( array, type )
|
| 316 |
+
else:
|
| 317 |
+
return array
|
| 318 |
+
globals()["glGetTexImage%s"%(suffix,)] = glGetTexImage
|
| 319 |
+
## def glGetTexSubImage( target, level,format,type ):
|
| 320 |
+
## """Get a texture-level as an image"""
|
| 321 |
+
## dims = [GL_1_1.glGetTexLevelParameteriv( target, level, GL_1_1.GL_TEXTURE_WIDTH )]
|
| 322 |
+
## if target != GL_1_1.GL_TEXTURE_1D:
|
| 323 |
+
## dims.append( GL_1_1.glGetTexLevelParameteriv( target, level, GL_1_1.GL_TEXTURE_HEIGHT ) )
|
| 324 |
+
## if target != GL_1_1.GL_TEXTURE_2D:
|
| 325 |
+
## dims.append( GL_1_1.glGetTexLevelParameteriv( target, level, GL_1_2.GL_TEXTURE_DEPTH ) )
|
| 326 |
+
## array = images.SetupPixelRead( format, tuple(dims), type )
|
| 327 |
+
## arrayType = arrays.GL_CONSTANT_TO_ARRAY_TYPE[ images.TYPE_TO_ARRAYTYPE.get(type,type) ]
|
| 328 |
+
## GL_1_1.glGetTexImage(
|
| 329 |
+
## target, level, format, type, ctypes.c_void_p( arrayType.dataPointer(array))
|
| 330 |
+
## )
|
| 331 |
+
## return array
|
| 332 |
+
## "%s = glGetTexImage"%(suffix)
|
| 333 |
+
try:
|
| 334 |
+
del suffix,type
|
| 335 |
+
except NameError as err:
|
| 336 |
+
pass
|
| 337 |
+
# Now the real glReadPixels...
|
| 338 |
+
def glReadPixels( x,y,width,height,format,type, array=None, outputType=bytes ):
|
| 339 |
+
"""Read specified pixels from the current display buffer
|
| 340 |
+
|
| 341 |
+
x,y,width,height -- location and dimensions of the image to read
|
| 342 |
+
from the buffer
|
| 343 |
+
format -- pixel format for the resulting data
|
| 344 |
+
type -- data-format for the resulting data
|
| 345 |
+
array -- optional array/offset into which to store the value
|
| 346 |
+
outputType -- default (bytes) provides string output of the
|
| 347 |
+
results iff OpenGL.UNSIGNED_BYTE_IMAGES_AS_STRING is True
|
| 348 |
+
and type == GL_UNSIGNED_BYTE. Any other value will cause
|
| 349 |
+
output in the default array output format.
|
| 350 |
+
|
| 351 |
+
returns the pixel data array in the format defined by the
|
| 352 |
+
format, type and outputType
|
| 353 |
+
"""
|
| 354 |
+
x,y,width,height = asInt(x),asInt(y),asInt(width),asInt(height)
|
| 355 |
+
|
| 356 |
+
arrayType = arrays.GL_CONSTANT_TO_ARRAY_TYPE[ images.TYPE_TO_ARRAYTYPE.get(type,type) ]
|
| 357 |
+
if array is None:
|
| 358 |
+
array = imageData = images.SetupPixelRead( format, (width,height), type )
|
| 359 |
+
owned = True
|
| 360 |
+
else:
|
| 361 |
+
if isinstance( array, integer_types):
|
| 362 |
+
imageData = ctypes.c_void_p( array )
|
| 363 |
+
else:
|
| 364 |
+
array = arrayType.asArray( array )
|
| 365 |
+
imageData = arrayType.voidDataPointer( array )
|
| 366 |
+
owned = False
|
| 367 |
+
|
| 368 |
+
GL_1_1.glReadPixels(
|
| 369 |
+
x,y,width,height,
|
| 370 |
+
format,type,
|
| 371 |
+
imageData
|
| 372 |
+
)
|
| 373 |
+
if owned and outputType is bytes:
|
| 374 |
+
return images.returnFormat( array, type )
|
| 375 |
+
else:
|
| 376 |
+
return array
|
| 377 |
+
|
| 378 |
+
def glGetTexImage( target, level,format,type, array=None, outputType=bytes ):
|
| 379 |
+
"""Get a texture-level as an image
|
| 380 |
+
|
| 381 |
+
target -- enum constant for the texture engine to be read
|
| 382 |
+
level -- the mip-map level to read
|
| 383 |
+
format -- image format to read out the data
|
| 384 |
+
type -- data-type into which to read the data
|
| 385 |
+
array -- optional array/offset into which to store the value
|
| 386 |
+
|
| 387 |
+
outputType -- default (bytes) provides string output of the
|
| 388 |
+
results iff OpenGL.UNSIGNED_BYTE_IMAGES_AS_STRING is True
|
| 389 |
+
and type == GL_UNSIGNED_BYTE. Any other value will cause
|
| 390 |
+
output in the default array output format.
|
| 391 |
+
|
| 392 |
+
returns the pixel data array in the format defined by the
|
| 393 |
+
format, type and outputType
|
| 394 |
+
"""
|
| 395 |
+
arrayType = arrays.GL_CONSTANT_TO_ARRAY_TYPE[ images.TYPE_TO_ARRAYTYPE.get(type,type) ]
|
| 396 |
+
if array is None:
|
| 397 |
+
dims = _get_texture_level_dims(target,level)
|
| 398 |
+
array = imageData = images.SetupPixelRead( format, tuple(dims), type )
|
| 399 |
+
owned = True
|
| 400 |
+
else:
|
| 401 |
+
if isinstance( array, integer_types):
|
| 402 |
+
imageData = ctypes.c_void_p( array )
|
| 403 |
+
else:
|
| 404 |
+
array = arrayType.asArray( array )
|
| 405 |
+
imageData = arrayType.voidDataPointer( array )
|
| 406 |
+
owned = False
|
| 407 |
+
GL_1_1.glGetTexImage(
|
| 408 |
+
target, level, format, type, imageData
|
| 409 |
+
)
|
| 410 |
+
if outputType is bytes:
|
| 411 |
+
return images.returnFormat( array, type )
|
| 412 |
+
else:
|
| 413 |
+
return array
|
| 414 |
+
|
| 415 |
+
|
| 416 |
+
INT_DIMENSION_NAMES = [
|
| 417 |
+
'width','height','depth','x','y','z',
|
| 418 |
+
'xoffset','yoffset','zoffset',
|
| 419 |
+
'start', 'count',
|
| 420 |
+
]
|
| 421 |
+
def asWrapper( value ):
|
| 422 |
+
if not isinstance( value, wrapper.Wrapper ):
|
| 423 |
+
return wrapper.wrapper( value )
|
| 424 |
+
return value
|
| 425 |
+
|
| 426 |
+
def asIntConverter( value, *args ):
|
| 427 |
+
if isinstance( value, float ):
|
| 428 |
+
return int(round(value,0))
|
| 429 |
+
return value
|
| 430 |
+
|
| 431 |
+
def setDimensionsAsInts( baseOperation ):
|
| 432 |
+
"""Set arguments with names in INT_DIMENSION_NAMES to asInt processing"""
|
| 433 |
+
baseOperation = asWrapper( baseOperation )
|
| 434 |
+
argNames = getattr( baseOperation, 'pyConverterNames', baseOperation.argNames )
|
| 435 |
+
for i,argName in enumerate(argNames):
|
| 436 |
+
if argName in INT_DIMENSION_NAMES:
|
| 437 |
+
baseOperation.setPyConverter( argName, asIntConverter )
|
| 438 |
+
return baseOperation
|
| 439 |
+
|
| 440 |
+
|
| 441 |
+
|
| 442 |
+
class ImageInputConverter( object ):
|
| 443 |
+
def __init__( self, rank, pixelsName=None, typeName='type' ):
|
| 444 |
+
self.rank = rank
|
| 445 |
+
self.typeName = typeName
|
| 446 |
+
self.pixelsName = pixelsName
|
| 447 |
+
def finalise( self, wrapper ):
|
| 448 |
+
"""Get our pixel index from the wrapper"""
|
| 449 |
+
self.typeIndex = wrapper.pyArgIndex( self.typeName )
|
| 450 |
+
self.pixelsIndex = wrapper.pyArgIndex( self.pixelsName )
|
| 451 |
+
def __call__( self, arg, baseOperation, pyArgs ):
|
| 452 |
+
"""pyConverter for the pixels argument"""
|
| 453 |
+
images.setupDefaultTransferMode()
|
| 454 |
+
images.rankPacking( self.rank )
|
| 455 |
+
type = pyArgs[ self.typeIndex ]
|
| 456 |
+
arrayType = arrays.GL_CONSTANT_TO_ARRAY_TYPE[ images.TYPE_TO_ARRAYTYPE[ type ] ]
|
| 457 |
+
return arrayType.asArray( arg )
|
| 458 |
+
# def cResolver( self, array ):
|
| 459 |
+
# return array
|
| 460 |
+
# return ctypes.c_void_p( arrays.ArrayDatatype.dataPointer( array ) )
|
| 461 |
+
|
| 462 |
+
class TypedImageInputConverter( ImageInputConverter ):
|
| 463 |
+
def __init__( self, rank, pixelsName, arrayType, typeName=None ):
|
| 464 |
+
self.rank = rank
|
| 465 |
+
self.arrayType = arrayType
|
| 466 |
+
self.pixelsName = pixelsName
|
| 467 |
+
self.typeName = typeName
|
| 468 |
+
def __call__( self, arg, baseOperation, pyArgs ):
|
| 469 |
+
"""The pyConverter for the pixels"""
|
| 470 |
+
images.setupDefaultTransferMode()
|
| 471 |
+
images.rankPacking( self.rank )
|
| 472 |
+
return self.arrayType.asArray( arg )
|
| 473 |
+
def finalise( self, wrapper ):
|
| 474 |
+
"""Get our pixel index from the wrapper"""
|
| 475 |
+
self.pixelsIndex = wrapper.pyArgIndex( self.pixelsName )
|
| 476 |
+
def width( self, pyArgs, index, wrappedOperation ):
|
| 477 |
+
"""Extract the width from the pixels argument"""
|
| 478 |
+
return self.arrayType.dimensions( pyArgs[self.pixelsIndex] )[0]
|
| 479 |
+
def height( self, pyArgs, index, wrappedOperation ):
|
| 480 |
+
"""Extract the height from the pixels argument"""
|
| 481 |
+
return self.arrayType.dimensions( pyArgs[self.pixelsIndex] )[1]
|
| 482 |
+
def depth( self, pyArgs, index, wrappedOperation ):
|
| 483 |
+
"""Extract the depth from the pixels argument"""
|
| 484 |
+
return self.arrayType.dimensions( pyArgs[self.pixelsIndex] )[2]
|
| 485 |
+
def type( self, pyArgs, index, wrappedOperation ):
|
| 486 |
+
"""Provide the item-type argument from our stored value
|
| 487 |
+
|
| 488 |
+
This is used for pre-bound processing where we want to provide
|
| 489 |
+
the type by implication...
|
| 490 |
+
"""
|
| 491 |
+
return self.typeName
|
| 492 |
+
|
| 493 |
+
class CompressedImageConverter( object ):
|
| 494 |
+
def finalise( self, wrapper ):
|
| 495 |
+
"""Get our pixel index from the wrapper"""
|
| 496 |
+
self.dataIndex = wrapper.pyArgIndex( 'data' )
|
| 497 |
+
def __call__( self, pyArgs, index, wrappedOperation ):
|
| 498 |
+
"""Create a data-size measurement for our image"""
|
| 499 |
+
arg = pyArgs[ self.dataIndex ]
|
| 500 |
+
return arrays.ArrayType.arrayByteCount( arg )
|
| 501 |
+
|
| 502 |
+
|
| 503 |
+
|
| 504 |
+
DIMENSION_NAMES = (
|
| 505 |
+
'width','height','depth'
|
| 506 |
+
)
|
| 507 |
+
PIXEL_NAMES = (
|
| 508 |
+
'pixels', 'row', 'column',
|
| 509 |
+
)
|
| 510 |
+
DATA_SIZE_NAMES = (
|
| 511 |
+
'imageSize',
|
| 512 |
+
)
|
| 513 |
+
|
| 514 |
+
def setImageInput(
|
| 515 |
+
baseOperation, arrayType=None, dimNames=DIMENSION_NAMES,
|
| 516 |
+
pixelName="pixels", typeName=None
|
| 517 |
+
):
|
| 518 |
+
"""Determine how to convert "pixels" into an image-compatible argument"""
|
| 519 |
+
baseOperation = asWrapper( baseOperation )
|
| 520 |
+
# rank is the count of width,height,depth arguments...
|
| 521 |
+
rank = len([
|
| 522 |
+
# rank is the number of dims we want, not the number we give...
|
| 523 |
+
argName for argName in baseOperation.argNames
|
| 524 |
+
if argName in dimNames
|
| 525 |
+
]) + 1
|
| 526 |
+
if arrayType:
|
| 527 |
+
converter = TypedImageInputConverter( rank, pixelName, arrayType, typeName=typeName )
|
| 528 |
+
for i,argName in enumerate(baseOperation.argNames):
|
| 529 |
+
if argName in dimNames:
|
| 530 |
+
baseOperation.setPyConverter( argName )
|
| 531 |
+
baseOperation.setCConverter( argName, getattr(converter,argName) )
|
| 532 |
+
elif argName == 'type' and typeName is not None:
|
| 533 |
+
baseOperation.setPyConverter( argName )
|
| 534 |
+
baseOperation.setCConverter( argName, converter.type )
|
| 535 |
+
else:
|
| 536 |
+
converter = ImageInputConverter( rank, pixelsName=pixelName, typeName=typeName or 'type' )
|
| 537 |
+
for argName in baseOperation.argNames:
|
| 538 |
+
if argName in DATA_SIZE_NAMES:
|
| 539 |
+
baseOperation.setPyConverter( argName )
|
| 540 |
+
baseOperation.setCConverter( argName, converter.imageDataSize )
|
| 541 |
+
baseOperation.setPyConverter(
|
| 542 |
+
pixelName, converter,
|
| 543 |
+
)
|
| 544 |
+
# baseOperation.setCResolver(
|
| 545 |
+
# pixelName, converter.cResolver
|
| 546 |
+
# )
|
| 547 |
+
return baseOperation
|
| 548 |
+
|
| 549 |
+
glDrawPixels = setDimensionsAsInts(
|
| 550 |
+
setImageInput(
|
| 551 |
+
GL_1_1.glDrawPixels
|
| 552 |
+
)
|
| 553 |
+
)
|
| 554 |
+
glTexSubImage2D = setDimensionsAsInts(
|
| 555 |
+
setImageInput(
|
| 556 |
+
GL_1_1.glTexSubImage2D
|
| 557 |
+
)
|
| 558 |
+
)
|
| 559 |
+
glTexSubImage1D = setDimensionsAsInts(
|
| 560 |
+
setImageInput(
|
| 561 |
+
GL_1_1.glTexSubImage1D
|
| 562 |
+
)
|
| 563 |
+
)
|
| 564 |
+
glTexImage2D = setDimensionsAsInts(
|
| 565 |
+
setImageInput(
|
| 566 |
+
GL_1_1.glTexImage2D
|
| 567 |
+
)
|
| 568 |
+
)
|
| 569 |
+
glTexImage1D = setDimensionsAsInts(
|
| 570 |
+
setImageInput(
|
| 571 |
+
GL_1_1.glTexImage1D
|
| 572 |
+
)
|
| 573 |
+
)
|
| 574 |
+
|
| 575 |
+
def typedImageFunction( suffix, arrayConstant, baseFunction ):
|
| 576 |
+
"""Produce a typed version of the given image function"""
|
| 577 |
+
functionName = baseFunction.__name__
|
| 578 |
+
functionName = '%(functionName)s%(suffix)s'%locals()
|
| 579 |
+
if baseFunction:
|
| 580 |
+
arrayType = arrays.GL_CONSTANT_TO_ARRAY_TYPE[ arrayConstant ]
|
| 581 |
+
function = setDimensionsAsInts(
|
| 582 |
+
setImageInput(
|
| 583 |
+
baseFunction,
|
| 584 |
+
arrayType,
|
| 585 |
+
typeName = arrayConstant,
|
| 586 |
+
)
|
| 587 |
+
)
|
| 588 |
+
return functionName, function
|
| 589 |
+
else:
|
| 590 |
+
return functionName, baseFunction
|
| 591 |
+
|
| 592 |
+
def _setDataSize( baseFunction, argument='imageSize' ):
|
| 593 |
+
"""Set the data-size value to come from the data field"""
|
| 594 |
+
if baseFunction:
|
| 595 |
+
converter = CompressedImageConverter()
|
| 596 |
+
return asWrapper( baseFunction ).setPyConverter(
|
| 597 |
+
argument
|
| 598 |
+
).setCConverter( argument, converter )
|
| 599 |
+
else:
|
| 600 |
+
return baseFunction
|
| 601 |
+
|
| 602 |
+
def compressedImageFunction( baseFunction ):
|
| 603 |
+
"""Set the imageSize and dimensions-as-ints converters for baseFunction"""
|
| 604 |
+
if baseFunction:
|
| 605 |
+
return setDimensionsAsInts(
|
| 606 |
+
_setDataSize(
|
| 607 |
+
baseFunction, argument='imageSize'
|
| 608 |
+
)
|
| 609 |
+
)
|
| 610 |
+
else:
|
| 611 |
+
return baseFunction
|
| 612 |
+
|
| 613 |
+
for suffix,arrayConstant in [
|
| 614 |
+
('b', GL_1_1.GL_BYTE),
|
| 615 |
+
('f', GL_1_1.GL_FLOAT),
|
| 616 |
+
('i', GL_1_1.GL_INT),
|
| 617 |
+
('s', GL_1_1.GL_SHORT),
|
| 618 |
+
('ub', GL_1_1.GL_UNSIGNED_BYTE),
|
| 619 |
+
('ui', GL_1_1.GL_UNSIGNED_INT),
|
| 620 |
+
('us', GL_1_1.GL_UNSIGNED_SHORT),
|
| 621 |
+
]:
|
| 622 |
+
for functionName in (
|
| 623 |
+
'glTexImage1D','glTexImage2D',
|
| 624 |
+
'glTexSubImage1D','glTexSubImage2D',
|
| 625 |
+
'glDrawPixels',
|
| 626 |
+
#'glTexSubImage3D','glTexImage3D', # extension/1.2 standard
|
| 627 |
+
):
|
| 628 |
+
functionName, function = typedImageFunction(
|
| 629 |
+
suffix, arrayConstant, getattr(GL_1_1,functionName),
|
| 630 |
+
)
|
| 631 |
+
globals()[functionName] = function
|
| 632 |
+
try:
|
| 633 |
+
del function, functionName
|
| 634 |
+
except NameError as err:
|
| 635 |
+
pass
|
| 636 |
+
try:
|
| 637 |
+
del suffix,arrayConstant
|
| 638 |
+
except NameError as err:
|
| 639 |
+
pass
|
vllm/lib/python3.10/site-packages/OpenGL/GL/pointers.py
ADDED
|
@@ -0,0 +1,308 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Implementations for "held-pointers" of various types
|
| 2 |
+
|
| 3 |
+
This argument type is special because it is stored, that is, it
|
| 4 |
+
needs to be cached on our side so that the memory address does not
|
| 5 |
+
go out-of-scope
|
| 6 |
+
|
| 7 |
+
storedPointers = {}
|
| 8 |
+
def glVertexPointerd( array ):
|
| 9 |
+
"Natural writing of glVertexPointerd using standard ctypes"
|
| 10 |
+
arg2 = GL_DOUBLE
|
| 11 |
+
arg3 = 0 # stride
|
| 12 |
+
arg4 = arrays.asArray(array, GL_DOUBLE)
|
| 13 |
+
arg1 = arrays.arraySize( arg4, 'd' )
|
| 14 |
+
platform.PLATFORM.GL.glVertexPointer( arg1, arg2, arg3, arrays.ArrayDatatype.dataPointer(arg4) )
|
| 15 |
+
# only store if we successfully set the value...
|
| 16 |
+
storedPointers[ GL_VERTEX_ARRAY ] = arg4
|
| 17 |
+
return arg4
|
| 18 |
+
"""
|
| 19 |
+
from OpenGL import platform, error, wrapper, contextdata, converters, constant
|
| 20 |
+
from OpenGL.arrays import arrayhelpers, arraydatatype
|
| 21 |
+
from OpenGL.raw.GL.VERSION import GL_1_1 as _simple
|
| 22 |
+
import ctypes
|
| 23 |
+
|
| 24 |
+
GLsizei = ctypes.c_int
|
| 25 |
+
GLenum = ctypes.c_uint
|
| 26 |
+
GLint = ctypes.c_int
|
| 27 |
+
# OpenGL-ctypes variables that mimic OpenGL constant operation...
|
| 28 |
+
GL_INTERLEAVED_ARRAY_POINTER = constant.Constant( 'GL_INTERLEAVED_ARRAY_POINTER', -32910 )
|
| 29 |
+
|
| 30 |
+
__all__ = (
|
| 31 |
+
'glColorPointer',
|
| 32 |
+
'glColorPointerb','glColorPointerd','glColorPointerf','glColorPointeri',
|
| 33 |
+
'glColorPointers','glColorPointerub','glColorPointerui','glColorPointerus',
|
| 34 |
+
'glEdgeFlagPointer',
|
| 35 |
+
'glEdgeFlagPointerb',
|
| 36 |
+
'glIndexPointer',
|
| 37 |
+
'glIndexPointerb','glIndexPointerd','glIndexPointerf',
|
| 38 |
+
'glIndexPointeri','glIndexPointers','glIndexPointerub',
|
| 39 |
+
'glNormalPointer',
|
| 40 |
+
'glNormalPointerb',
|
| 41 |
+
'glNormalPointerd','glNormalPointerf','glNormalPointeri','glNormalPointers',
|
| 42 |
+
'glTexCoordPointer',
|
| 43 |
+
'glTexCoordPointerb','glTexCoordPointerd','glTexCoordPointerf',
|
| 44 |
+
'glTexCoordPointeri','glTexCoordPointers',
|
| 45 |
+
'glVertexPointer',
|
| 46 |
+
'glVertexPointerb','glVertexPointerd','glVertexPointerf','glVertexPointeri',
|
| 47 |
+
'glVertexPointers',
|
| 48 |
+
'glDrawElements','glDrawElementsui','glDrawElementsub','glDrawElementsus',
|
| 49 |
+
'glFeedbackBuffer',
|
| 50 |
+
'glSelectBuffer',
|
| 51 |
+
'glRenderMode',
|
| 52 |
+
'glGetPointerv',
|
| 53 |
+
'glInterleavedArrays',
|
| 54 |
+
'GL_INTERLEAVED_ARRAY_POINTER',
|
| 55 |
+
)
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
# Have to create *new* ctypes wrappers for the platform object!
|
| 59 |
+
# We can't just alter the default one since we have different ways of
|
| 60 |
+
# calling it
|
| 61 |
+
|
| 62 |
+
POINTER_FUNCTION_DATA = [
|
| 63 |
+
('glColorPointerd', _simple.glColorPointer, _simple.GL_DOUBLE, _simple.GL_COLOR_ARRAY_POINTER, 0, 3),
|
| 64 |
+
('glColorPointerf', _simple.glColorPointer, _simple.GL_FLOAT, _simple.GL_COLOR_ARRAY_POINTER, 0, 3),
|
| 65 |
+
('glColorPointeri', _simple.glColorPointer, _simple.GL_INT, _simple.GL_COLOR_ARRAY_POINTER, 0, 3),
|
| 66 |
+
('glColorPointers', _simple.glColorPointer, _simple.GL_SHORT, _simple.GL_COLOR_ARRAY_POINTER, 0, 3),
|
| 67 |
+
('glColorPointerub', _simple.glColorPointer, _simple.GL_UNSIGNED_BYTE, _simple.GL_COLOR_ARRAY_POINTER, 0, 3),
|
| 68 |
+
# these data-types are mapped from diff Numeric types
|
| 69 |
+
('glColorPointerb', _simple.glColorPointer, _simple.GL_BYTE, _simple.GL_COLOR_ARRAY_POINTER, 0, 3),
|
| 70 |
+
('glColorPointerui', _simple.glColorPointer, _simple.GL_UNSIGNED_INT, _simple.GL_COLOR_ARRAY_POINTER, 0, 3),
|
| 71 |
+
('glColorPointerus', _simple.glColorPointer, _simple.GL_UNSIGNED_SHORT, _simple.GL_COLOR_ARRAY_POINTER, 0, 3),
|
| 72 |
+
|
| 73 |
+
('glEdgeFlagPointerb', _simple.glEdgeFlagPointer, _simple.GL_BYTE, _simple.GL_EDGE_FLAG_ARRAY_POINTER, 2, None),
|
| 74 |
+
|
| 75 |
+
('glIndexPointerd', _simple.glIndexPointer, _simple.GL_DOUBLE, _simple.GL_INDEX_ARRAY_POINTER, 1, None),
|
| 76 |
+
('glIndexPointerf', _simple.glIndexPointer, _simple.GL_FLOAT, _simple.GL_INDEX_ARRAY_POINTER, 1, None),
|
| 77 |
+
('glIndexPointeri', _simple.glIndexPointer, _simple.GL_INT, _simple.GL_INDEX_ARRAY_POINTER, 1, None),
|
| 78 |
+
('glIndexPointerub', _simple.glIndexPointer, _simple.GL_UNSIGNED_BYTE, _simple.GL_INDEX_ARRAY_POINTER, 1, None),
|
| 79 |
+
('glIndexPointers', _simple.glIndexPointer, _simple.GL_SHORT, _simple.GL_INDEX_ARRAY_POINTER, 1, None),
|
| 80 |
+
# these data-types are mapped from diff Numeric types
|
| 81 |
+
('glIndexPointerb', _simple.glIndexPointer, _simple.GL_BYTE, _simple.GL_INDEX_ARRAY_POINTER, 1, None),
|
| 82 |
+
|
| 83 |
+
('glNormalPointerd', _simple.glNormalPointer, _simple.GL_DOUBLE, _simple.GL_NORMAL_ARRAY_POINTER, 1, None),
|
| 84 |
+
('glNormalPointerf', _simple.glNormalPointer, _simple.GL_FLOAT, _simple.GL_NORMAL_ARRAY_POINTER, 1, None),
|
| 85 |
+
('glNormalPointeri', _simple.glNormalPointer, _simple.GL_INT, _simple.GL_NORMAL_ARRAY_POINTER, 1, None),
|
| 86 |
+
('glNormalPointerb', _simple.glNormalPointer, _simple.GL_BYTE, _simple.GL_NORMAL_ARRAY_POINTER, 1, None),
|
| 87 |
+
('glNormalPointers', _simple.glNormalPointer, _simple.GL_SHORT, _simple.GL_NORMAL_ARRAY_POINTER, 1, None),
|
| 88 |
+
|
| 89 |
+
('glTexCoordPointerd', _simple.glTexCoordPointer, _simple.GL_DOUBLE, _simple.GL_TEXTURE_COORD_ARRAY_POINTER, 0, 2),
|
| 90 |
+
('glTexCoordPointerf', _simple.glTexCoordPointer, _simple.GL_FLOAT, _simple.GL_TEXTURE_COORD_ARRAY_POINTER, 0, 2),
|
| 91 |
+
('glTexCoordPointeri', _simple.glTexCoordPointer, _simple.GL_INT, _simple.GL_TEXTURE_COORD_ARRAY_POINTER, 0, 2),
|
| 92 |
+
('glTexCoordPointerb', _simple.glTexCoordPointer, _simple.GL_BYTE, _simple.GL_TEXTURE_COORD_ARRAY_POINTER, 0, 2),
|
| 93 |
+
('glTexCoordPointers', _simple.glTexCoordPointer, _simple.GL_SHORT, _simple.GL_TEXTURE_COORD_ARRAY_POINTER, 0, 2),
|
| 94 |
+
|
| 95 |
+
('glVertexPointerd', _simple.glVertexPointer, _simple.GL_DOUBLE, _simple.GL_VERTEX_ARRAY_POINTER, 0, 3),
|
| 96 |
+
('glVertexPointerf', _simple.glVertexPointer, _simple.GL_FLOAT, _simple.GL_VERTEX_ARRAY_POINTER, 0, 3),
|
| 97 |
+
('glVertexPointeri', _simple.glVertexPointer, _simple.GL_INT, _simple.GL_VERTEX_ARRAY_POINTER, 0, 3),
|
| 98 |
+
('glVertexPointerb', _simple.glVertexPointer, _simple.GL_INT, _simple.GL_VERTEX_ARRAY_POINTER, 0, 3),
|
| 99 |
+
('glVertexPointers', _simple.glVertexPointer, _simple.GL_SHORT, _simple.GL_VERTEX_ARRAY_POINTER, 0, 3),
|
| 100 |
+
]
|
| 101 |
+
def wrapPointerFunction( name, baseFunction, glType, arrayType,startArgs, defaultSize ):
|
| 102 |
+
"""Wrap the given pointer-setting function"""
|
| 103 |
+
function= wrapper.wrapper( baseFunction )
|
| 104 |
+
if 'ptr' in baseFunction.argNames:
|
| 105 |
+
pointer_name = 'ptr'
|
| 106 |
+
else:
|
| 107 |
+
pointer_name = 'pointer'
|
| 108 |
+
assert not getattr( function, 'pyConverters', None ), """Reusing wrappers?"""
|
| 109 |
+
if arrayType:
|
| 110 |
+
arrayModuleType = arraydatatype.GL_CONSTANT_TO_ARRAY_TYPE[ glType ]
|
| 111 |
+
function.setPyConverter( pointer_name, arrayhelpers.asArrayType(arrayModuleType) )
|
| 112 |
+
else:
|
| 113 |
+
function.setPyConverter( pointer_name, arrayhelpers.AsArrayOfType(pointer_name,'type') )
|
| 114 |
+
function.setCConverter( pointer_name, converters.getPyArgsName( pointer_name ) )
|
| 115 |
+
if 'size' in function.argNames:
|
| 116 |
+
function.setPyConverter( 'size' )
|
| 117 |
+
function.setCConverter( 'size', arrayhelpers.arraySizeOfFirstType(arrayModuleType,defaultSize) )
|
| 118 |
+
if 'type' in function.argNames:
|
| 119 |
+
function.setPyConverter( 'type' )
|
| 120 |
+
function.setCConverter( 'type', glType )
|
| 121 |
+
if 'stride' in function.argNames:
|
| 122 |
+
function.setPyConverter( 'stride' )
|
| 123 |
+
function.setCConverter( 'stride', 0 )
|
| 124 |
+
function.setStoreValues( arrayhelpers.storePointerType( pointer_name, arrayType ) )
|
| 125 |
+
function.setReturnValues( wrapper.returnPyArgument( pointer_name ) )
|
| 126 |
+
return name,function
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
for name,function in [
|
| 131 |
+
wrapPointerFunction( *args )
|
| 132 |
+
for args in POINTER_FUNCTION_DATA
|
| 133 |
+
]:
|
| 134 |
+
globals()[name] = function
|
| 135 |
+
try:
|
| 136 |
+
del name, function
|
| 137 |
+
except NameError as err:
|
| 138 |
+
pass
|
| 139 |
+
|
| 140 |
+
glVertexPointer = wrapper.wrapper( _simple.glVertexPointer ).setPyConverter(
|
| 141 |
+
'pointer', arrayhelpers.AsArrayOfType( 'pointer', 'type' ),
|
| 142 |
+
).setStoreValues(
|
| 143 |
+
arrayhelpers.storePointerType( 'pointer', _simple.GL_VERTEX_ARRAY_POINTER )
|
| 144 |
+
).setReturnValues(
|
| 145 |
+
wrapper.returnPyArgument( 'pointer' )
|
| 146 |
+
)
|
| 147 |
+
glTexCoordPointer = wrapper.wrapper( _simple.glTexCoordPointer ).setPyConverter(
|
| 148 |
+
'pointer', arrayhelpers.AsArrayOfType( 'pointer', 'type' ),
|
| 149 |
+
).setStoreValues(
|
| 150 |
+
arrayhelpers.storePointerType( 'pointer', _simple.GL_TEXTURE_COORD_ARRAY_POINTER )
|
| 151 |
+
).setReturnValues(
|
| 152 |
+
wrapper.returnPyArgument( 'pointer' )
|
| 153 |
+
)
|
| 154 |
+
glNormalPointer = wrapper.wrapper( _simple.glNormalPointer ).setPyConverter(
|
| 155 |
+
'pointer', arrayhelpers.AsArrayOfType( 'pointer', 'type' ),
|
| 156 |
+
).setStoreValues(
|
| 157 |
+
arrayhelpers.storePointerType( 'pointer', _simple.GL_NORMAL_ARRAY_POINTER )
|
| 158 |
+
).setReturnValues(
|
| 159 |
+
wrapper.returnPyArgument( 'pointer' )
|
| 160 |
+
)
|
| 161 |
+
glIndexPointer = wrapper.wrapper( _simple.glIndexPointer ).setPyConverter(
|
| 162 |
+
'pointer', arrayhelpers.AsArrayOfType( 'pointer', 'type' ),
|
| 163 |
+
).setStoreValues(
|
| 164 |
+
arrayhelpers.storePointerType( 'pointer', _simple.GL_INDEX_ARRAY_POINTER )
|
| 165 |
+
).setReturnValues(
|
| 166 |
+
wrapper.returnPyArgument( 'pointer' )
|
| 167 |
+
)
|
| 168 |
+
glEdgeFlagPointer = wrapper.wrapper( _simple.glEdgeFlagPointer ).setPyConverter(
|
| 169 |
+
# XXX type is wrong!
|
| 170 |
+
'pointer', arrayhelpers.AsArrayTyped( 'pointer', arraydatatype.GLushortArray ),
|
| 171 |
+
).setStoreValues(
|
| 172 |
+
arrayhelpers.storePointerType( 'pointer', _simple.GL_EDGE_FLAG_ARRAY_POINTER )
|
| 173 |
+
).setReturnValues(
|
| 174 |
+
wrapper.returnPyArgument( 'pointer' )
|
| 175 |
+
)
|
| 176 |
+
glColorPointer = wrapper.wrapper( _simple.glColorPointer ).setPyConverter(
|
| 177 |
+
'pointer', arrayhelpers.AsArrayOfType( 'pointer', 'type' ),
|
| 178 |
+
).setStoreValues(
|
| 179 |
+
arrayhelpers.storePointerType( 'pointer', _simple.GL_COLOR_ARRAY_POINTER )
|
| 180 |
+
).setReturnValues(
|
| 181 |
+
wrapper.returnPyArgument( 'pointer' )
|
| 182 |
+
)
|
| 183 |
+
glInterleavedArrays = wrapper.wrapper( _simple.glInterleavedArrays ).setStoreValues(
|
| 184 |
+
arrayhelpers.storePointerType( 'pointer', GL_INTERLEAVED_ARRAY_POINTER )
|
| 185 |
+
).setReturnValues(
|
| 186 |
+
wrapper.returnPyArgument( 'pointer' )
|
| 187 |
+
)
|
| 188 |
+
|
| 189 |
+
|
| 190 |
+
glDrawElements = wrapper.wrapper( _simple.glDrawElements ).setPyConverter(
|
| 191 |
+
'indices', arrayhelpers.AsArrayOfType( 'indices', 'type' ),
|
| 192 |
+
).setReturnValues(
|
| 193 |
+
wrapper.returnPyArgument( 'indices' )
|
| 194 |
+
)
|
| 195 |
+
|
| 196 |
+
def glDrawElementsTyped( type, suffix ):
|
| 197 |
+
arrayType = arraydatatype.GL_CONSTANT_TO_ARRAY_TYPE[ type ]
|
| 198 |
+
function = wrapper.wrapper(
|
| 199 |
+
_simple.glDrawElements
|
| 200 |
+
).setPyConverter('type').setCConverter(
|
| 201 |
+
'type', type
|
| 202 |
+
).setPyConverter('count').setCConverter(
|
| 203 |
+
'count', arrayhelpers.AsArrayTypedSize( 'indices', arrayType ),
|
| 204 |
+
).setPyConverter(
|
| 205 |
+
'indices', arrayhelpers.AsArrayTyped( 'indices', arrayType ),
|
| 206 |
+
).setReturnValues(
|
| 207 |
+
wrapper.returnPyArgument( 'indices' )
|
| 208 |
+
)
|
| 209 |
+
return function
|
| 210 |
+
for type,suffix in ((_simple.GL_UNSIGNED_BYTE,'ub'),(_simple.GL_UNSIGNED_INT,'ui'),(_simple.GL_UNSIGNED_SHORT,'us')):
|
| 211 |
+
globals()['glDrawElements%(suffix)s'%globals()] = glDrawElementsTyped( type,suffix )
|
| 212 |
+
try:
|
| 213 |
+
del type,suffix,glDrawElementsTyped
|
| 214 |
+
except NameError as err:
|
| 215 |
+
pass
|
| 216 |
+
|
| 217 |
+
# create buffer of given size and return it for future reference
|
| 218 |
+
# keep a per-context weakref around to allow us to return the original
|
| 219 |
+
# array we returned IFF the user has kept a reference as well...
|
| 220 |
+
def glSelectBuffer( size, buffer = None ):
|
| 221 |
+
"""Create a selection buffer of the given size
|
| 222 |
+
"""
|
| 223 |
+
if buffer is None:
|
| 224 |
+
buffer = arraydatatype.GLuintArray.zeros( (size,) )
|
| 225 |
+
_simple.glSelectBuffer( size, buffer )
|
| 226 |
+
contextdata.setValue( _simple.GL_SELECTION_BUFFER_POINTER, buffer )
|
| 227 |
+
return buffer
|
| 228 |
+
def glFeedbackBuffer( size, type, buffer = None ):
|
| 229 |
+
"""Create a selection buffer of the given size
|
| 230 |
+
"""
|
| 231 |
+
if buffer is None:
|
| 232 |
+
buffer = arraydatatype.GLfloatArray.zeros( (size,) )
|
| 233 |
+
_simple.glFeedbackBuffer( size, type, buffer )
|
| 234 |
+
contextdata.setValue( _simple.GL_FEEDBACK_BUFFER_POINTER, buffer )
|
| 235 |
+
contextdata.setValue( "GL_FEEDBACK_BUFFER_TYPE", type )
|
| 236 |
+
return buffer
|
| 237 |
+
|
| 238 |
+
def glRenderMode( newMode ):
|
| 239 |
+
"""Change to the given rendering mode
|
| 240 |
+
|
| 241 |
+
If the current mode is GL_FEEDBACK or GL_SELECT, return
|
| 242 |
+
the current buffer appropriate to the mode
|
| 243 |
+
"""
|
| 244 |
+
# must get the current mode to determine operation...
|
| 245 |
+
from OpenGL.GL import glGetIntegerv
|
| 246 |
+
from OpenGL.GL import selection, feedback
|
| 247 |
+
currentMode = glGetIntegerv( _simple.GL_RENDER_MODE )
|
| 248 |
+
try:
|
| 249 |
+
currentMode = currentMode[0]
|
| 250 |
+
except (TypeError,ValueError,IndexError) as err:
|
| 251 |
+
pass
|
| 252 |
+
if currentMode in (_simple.GL_RENDER,0):
|
| 253 |
+
# no array needs to be returned...
|
| 254 |
+
return _simple.glRenderMode( newMode )
|
| 255 |
+
result = _simple.glRenderMode( newMode )
|
| 256 |
+
# result is now an integer telling us how many elements were copied...
|
| 257 |
+
|
| 258 |
+
if result < 0:
|
| 259 |
+
if currentMode == _simple.GL_SELECT:
|
| 260 |
+
raise error.GLError(
|
| 261 |
+
_simple.GL_STACK_OVERFLOW,
|
| 262 |
+
"glSelectBuffer too small to hold selection results",
|
| 263 |
+
)
|
| 264 |
+
elif currentMode == _simple.GL_FEEDBACK:
|
| 265 |
+
raise error.GLError(
|
| 266 |
+
_simple.GL_STACK_OVERFLOW,
|
| 267 |
+
"glFeedbackBuffer too small to hold selection results",
|
| 268 |
+
)
|
| 269 |
+
else:
|
| 270 |
+
raise error.GLError(
|
| 271 |
+
_simple.GL_STACK_OVERFLOW,
|
| 272 |
+
"Unknown glRenderMode buffer (%s) too small to hold selection results"%(
|
| 273 |
+
currentMode,
|
| 274 |
+
),
|
| 275 |
+
)
|
| 276 |
+
# Okay, now that the easy cases are out of the way...
|
| 277 |
+
# Do we have a pre-stored pointer about which the user already knows?
|
| 278 |
+
context = platform.GetCurrentContext()
|
| 279 |
+
if context == 0:
|
| 280 |
+
raise error.Error(
|
| 281 |
+
"""Returning from glRenderMode without a valid context!"""
|
| 282 |
+
)
|
| 283 |
+
arrayConstant, wrapperFunction = {
|
| 284 |
+
_simple.GL_FEEDBACK: (_simple.GL_FEEDBACK_BUFFER_POINTER,feedback.parseFeedback),
|
| 285 |
+
_simple.GL_SELECT: (_simple.GL_SELECTION_BUFFER_POINTER, selection.GLSelectRecord.fromArray),
|
| 286 |
+
}[ currentMode ]
|
| 287 |
+
current = contextdata.getValue( arrayConstant )
|
| 288 |
+
# XXX check to see if it's the *same* array we set currently!
|
| 289 |
+
if current is None:
|
| 290 |
+
current = glGetPointerv( arrayConstant )
|
| 291 |
+
# XXX now, can turn the array into the appropriate wrapper type...
|
| 292 |
+
if wrapperFunction:
|
| 293 |
+
current = wrapperFunction( current, result )
|
| 294 |
+
return current
|
| 295 |
+
|
| 296 |
+
# XXX this belongs in the GL module, not here!
|
| 297 |
+
def glGetPointerv( constant ):
|
| 298 |
+
"""Retrieve a stored pointer constant"""
|
| 299 |
+
# do we have a cached version of the pointer?
|
| 300 |
+
# get the base pointer from the underlying operation
|
| 301 |
+
vp = ctypes.voidp()
|
| 302 |
+
_simple.glGetPointerv( constant, ctypes.byref(vp) )
|
| 303 |
+
current = contextdata.getValue( constant )
|
| 304 |
+
if current is not None:
|
| 305 |
+
if arraydatatype.ArrayDatatype.dataPointer( current ) == vp.value:
|
| 306 |
+
return current
|
| 307 |
+
# XXX should be coercing to the proper type and converting to an array
|
| 308 |
+
return vp
|
vllm/lib/python3.10/site-packages/OpenGL/GL/selection.py
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Selection-buffer handling code
|
| 2 |
+
|
| 3 |
+
This code is resonsible for turning gluint *
|
| 4 |
+
arrays into structured representations for use
|
| 5 |
+
by Python-level code.
|
| 6 |
+
"""
|
| 7 |
+
from OpenGL._bytes import integer_types
|
| 8 |
+
|
| 9 |
+
def uintToLong( value ):
|
| 10 |
+
if value < 0:
|
| 11 |
+
# array type without a uint, so represented as an int
|
| 12 |
+
value = (value & 0x7fffffff) + 0x80000000
|
| 13 |
+
return value
|
| 14 |
+
|
| 15 |
+
class GLSelectRecord( object ):
|
| 16 |
+
"""Minimalist object for storing an OpenGL selection-buffer record
|
| 17 |
+
|
| 18 |
+
Provides near and far as *float* values by dividing by
|
| 19 |
+
self.DISTANCE_DIVISOR (2**32-1)
|
| 20 |
+
From the spec:
|
| 21 |
+
Depth values (which are in the range [0,1]) are multiplied by
|
| 22 |
+
2^32 - 1, before being placed in the hit record.
|
| 23 |
+
|
| 24 |
+
Names are unmodified, so normally are slices of the array passed in
|
| 25 |
+
to GLSelectRecord.fromArray( array )
|
| 26 |
+
"""
|
| 27 |
+
DISTANCE_DIVISOR = float((2**32)-1)
|
| 28 |
+
__slots__ = ('near','far','names')
|
| 29 |
+
def fromArray( cls, array, total ):
|
| 30 |
+
"""Produce list with all records from the array"""
|
| 31 |
+
result = []
|
| 32 |
+
index = 0
|
| 33 |
+
arrayLength = len(array)
|
| 34 |
+
for item in range( total ):
|
| 35 |
+
if index + 2 >= arrayLength:
|
| 36 |
+
break
|
| 37 |
+
count = array[index]
|
| 38 |
+
near = array[index+1]
|
| 39 |
+
far = array[index+2]
|
| 40 |
+
names = [ uintToLong(v) for v in array[index+3:index+3+count]]
|
| 41 |
+
result.append( cls( near, far, names ) )
|
| 42 |
+
index += 3+count
|
| 43 |
+
return result
|
| 44 |
+
fromArray = classmethod( fromArray )
|
| 45 |
+
|
| 46 |
+
def __init__( self, near, far, names ):
|
| 47 |
+
"""Initialise/store the values"""
|
| 48 |
+
self.near = self.convertDistance( near )
|
| 49 |
+
self.far = self.convertDistance( far )
|
| 50 |
+
self.names = names
|
| 51 |
+
def convertDistance( self, value ):
|
| 52 |
+
"""Convert a distance value from array uint to 0.0-1.0 range float"""
|
| 53 |
+
return uintToLong( value ) / self.DISTANCE_DIVISOR
|
| 54 |
+
def __getitem__( self, key ):
|
| 55 |
+
"""Allow for treating the record as a three-tuple"""
|
| 56 |
+
if isinstance( key, integer_types):
|
| 57 |
+
return (self.near,self.far,self.names)[key]
|
| 58 |
+
elif key in self.__slots__:
|
| 59 |
+
try:
|
| 60 |
+
return getattr( self, key )
|
| 61 |
+
except AttributeError as err:
|
| 62 |
+
raise KeyError( """Don't have an index/key %r for %s instant"""%(
|
| 63 |
+
key, self.__class__,
|
| 64 |
+
))
|
vllm/lib/python3.10/site-packages/OpenGL/GL/shaders.py
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Convenience module providing common shader entry points
|
| 2 |
+
|
| 3 |
+
The point of this module is to allow client code to use
|
| 4 |
+
OpenGL Core names to reference shader-related operations
|
| 5 |
+
even if the local hardware only supports ARB extension-based
|
| 6 |
+
shader rendering.
|
| 7 |
+
|
| 8 |
+
There are also two utility methods compileProgram and compileShader
|
| 9 |
+
which make it easy to create demos which are shader-using.
|
| 10 |
+
"""
|
| 11 |
+
import logging
|
| 12 |
+
log = logging.getLogger( __name__ )
|
| 13 |
+
from OpenGL import GL
|
| 14 |
+
from OpenGL.GL.ARB import (
|
| 15 |
+
shader_objects, fragment_shader, vertex_shader, vertex_program,
|
| 16 |
+
geometry_shader4, separate_shader_objects, get_program_binary,
|
| 17 |
+
)
|
| 18 |
+
from OpenGL.extensions import alternate
|
| 19 |
+
from OpenGL._bytes import bytes,unicode,as_8_bit
|
| 20 |
+
|
| 21 |
+
__all__ = [
|
| 22 |
+
'glAttachShader',
|
| 23 |
+
'glDeleteShader',
|
| 24 |
+
'glGetProgramInfoLog',
|
| 25 |
+
'glGetShaderInfoLog',
|
| 26 |
+
'glGetProgramiv',
|
| 27 |
+
'glGetShaderiv',
|
| 28 |
+
'compileProgram',
|
| 29 |
+
'compileShader',
|
| 30 |
+
'GL_VALIDATE_STATUS',
|
| 31 |
+
'GL_LINK_STATUS',
|
| 32 |
+
# automatically added stuff here...
|
| 33 |
+
]
|
| 34 |
+
|
| 35 |
+
def _alt( base, name ):
|
| 36 |
+
if hasattr( GL, base ):
|
| 37 |
+
root = getattr( GL, base )
|
| 38 |
+
if hasattr(root,'__call__'):
|
| 39 |
+
globals()[base] = alternate(
|
| 40 |
+
getattr(GL,base),
|
| 41 |
+
getattr(module,name)
|
| 42 |
+
)
|
| 43 |
+
__all__.append( base )
|
| 44 |
+
else:
|
| 45 |
+
globals()[base] = root
|
| 46 |
+
__all__.append( base )
|
| 47 |
+
return True
|
| 48 |
+
return False
|
| 49 |
+
_excludes = ['glGetProgramiv']
|
| 50 |
+
for module in (
|
| 51 |
+
shader_objects,fragment_shader,vertex_shader,vertex_program,
|
| 52 |
+
geometry_shader4,
|
| 53 |
+
):
|
| 54 |
+
for name in dir(module):
|
| 55 |
+
found = None
|
| 56 |
+
for suffix in ('ObjectARB','_ARB','ARB'):
|
| 57 |
+
if name.endswith( suffix ):
|
| 58 |
+
found = False
|
| 59 |
+
base = name[:-(len(suffix))]
|
| 60 |
+
if base not in _excludes:
|
| 61 |
+
if _alt( base, name ):
|
| 62 |
+
found = True
|
| 63 |
+
break
|
| 64 |
+
if found is False:
|
| 65 |
+
log.debug( '''Found no alternate for: %s.%s''',
|
| 66 |
+
module.__name__,name,
|
| 67 |
+
)
|
| 68 |
+
|
| 69 |
+
glAttachShader = alternate( GL.glAttachShader,shader_objects.glAttachObjectARB )
|
| 70 |
+
glDetachShader = alternate( GL.glDetachShader,shader_objects.glDetachObjectARB )
|
| 71 |
+
glDeleteShader = alternate( GL.glDeleteShader,shader_objects.glDeleteObjectARB )
|
| 72 |
+
glGetAttachedShaders = alternate( GL.glGetAttachedShaders, shader_objects.glGetAttachedObjectsARB )
|
| 73 |
+
|
| 74 |
+
glGetProgramInfoLog = alternate( GL.glGetProgramInfoLog, shader_objects.glGetInfoLogARB )
|
| 75 |
+
glGetShaderInfoLog = alternate( GL.glGetShaderInfoLog, shader_objects.glGetInfoLogARB )
|
| 76 |
+
|
| 77 |
+
glGetShaderiv = alternate( GL.glGetShaderiv, shader_objects.glGetObjectParameterivARB )
|
| 78 |
+
glGetProgramiv = alternate( GL.glGetProgramiv, shader_objects.glGetObjectParameterivARB )
|
| 79 |
+
|
| 80 |
+
GL_VALIDATE_STATUS = GL.GL_VALIDATE_STATUS
|
| 81 |
+
GL_COMPILE_STATUS = GL.GL_COMPILE_STATUS
|
| 82 |
+
GL_LINK_STATUS = GL.GL_LINK_STATUS
|
| 83 |
+
GL_FALSE = GL.GL_FALSE
|
| 84 |
+
GL_TRUE = GL.GL_TRUE
|
| 85 |
+
|
| 86 |
+
class ShaderProgram( int ):
|
| 87 |
+
"""Integer sub-class with context-manager operation"""
|
| 88 |
+
def __enter__( self ):
|
| 89 |
+
"""Start use of the program"""
|
| 90 |
+
glUseProgram( self )
|
| 91 |
+
def __exit__( self, typ, val, tb ):
|
| 92 |
+
"""Stop use of the program"""
|
| 93 |
+
glUseProgram( 0 )
|
| 94 |
+
|
| 95 |
+
def check_validate( self ):
|
| 96 |
+
"""Check that the program validates
|
| 97 |
+
|
| 98 |
+
Validation has to occur *after* linking/loading
|
| 99 |
+
|
| 100 |
+
raises RuntimeError on failures
|
| 101 |
+
"""
|
| 102 |
+
glValidateProgram( self )
|
| 103 |
+
validation = glGetProgramiv( self, GL_VALIDATE_STATUS )
|
| 104 |
+
if validation == GL_FALSE:
|
| 105 |
+
raise RuntimeError(
|
| 106 |
+
"""Validation failure (%r): %s"""%(
|
| 107 |
+
validation,
|
| 108 |
+
glGetProgramInfoLog( self ),
|
| 109 |
+
))
|
| 110 |
+
return self
|
| 111 |
+
|
| 112 |
+
def check_linked( self ):
|
| 113 |
+
"""Check link status for this program
|
| 114 |
+
|
| 115 |
+
raises RuntimeError on failures
|
| 116 |
+
"""
|
| 117 |
+
link_status = glGetProgramiv( self, GL_LINK_STATUS )
|
| 118 |
+
if link_status == GL_FALSE:
|
| 119 |
+
raise RuntimeError(
|
| 120 |
+
"""Link failure (%s): %s"""%(
|
| 121 |
+
link_status,
|
| 122 |
+
glGetProgramInfoLog( self ),
|
| 123 |
+
))
|
| 124 |
+
return self
|
| 125 |
+
|
| 126 |
+
def retrieve( self ):
|
| 127 |
+
"""Attempt to retrieve binary for this compiled shader
|
| 128 |
+
|
| 129 |
+
Note that binaries for a program are *not* generally portable,
|
| 130 |
+
they should be used solely for caching compiled programs for
|
| 131 |
+
local use; i.e. to reduce compilation overhead.
|
| 132 |
+
|
| 133 |
+
returns (format,binaryData) for the shader program
|
| 134 |
+
"""
|
| 135 |
+
from OpenGL.raw.GL._types import GLint,GLenum
|
| 136 |
+
from OpenGL.arrays import GLbyteArray
|
| 137 |
+
size = GLint()
|
| 138 |
+
glGetProgramiv( self, get_program_binary.GL_PROGRAM_BINARY_LENGTH, size )
|
| 139 |
+
result = GLbyteArray.zeros( (size.value,))
|
| 140 |
+
size2 = GLint()
|
| 141 |
+
format = GLenum()
|
| 142 |
+
get_program_binary.glGetProgramBinary( self, size.value, size2, format, result )
|
| 143 |
+
return format.value, result
|
| 144 |
+
def load( self, format, binary ):
|
| 145 |
+
"""Attempt to load binary-format for a pre-compiled shader
|
| 146 |
+
|
| 147 |
+
See notes in retrieve
|
| 148 |
+
"""
|
| 149 |
+
get_program_binary.glProgramBinary( self, format, binary, len(binary))
|
| 150 |
+
self.check_validate() # On AMD Linux we see this fail, despite logging "validation successful"
|
| 151 |
+
self.check_linked()
|
| 152 |
+
return self
|
| 153 |
+
|
| 154 |
+
def compileProgram(*shaders, **named):
|
| 155 |
+
"""Create a new program, attach shaders and validate
|
| 156 |
+
|
| 157 |
+
shaders -- arbitrary number of shaders to attach to the
|
| 158 |
+
generated program.
|
| 159 |
+
separable (keyword only) -- set the separable flag to allow
|
| 160 |
+
for partial installation of shader into the pipeline (see
|
| 161 |
+
glUseProgramStages)
|
| 162 |
+
retrievable (keyword only) -- set the retrievable flag to
|
| 163 |
+
allow retrieval of the program binary representation, (see
|
| 164 |
+
glProgramBinary, glGetProgramBinary)
|
| 165 |
+
|
| 166 |
+
This convenience function is *not* standard OpenGL,
|
| 167 |
+
but it does wind up being fairly useful for demos
|
| 168 |
+
and the like. You may wish to copy it to your code
|
| 169 |
+
base to guard against PyOpenGL changes.
|
| 170 |
+
|
| 171 |
+
Usage:
|
| 172 |
+
|
| 173 |
+
shader = compileProgram(
|
| 174 |
+
compileShader( source, GL_VERTEX_SHADER ),
|
| 175 |
+
compileShader( source2, GL_FRAGMENT_SHADER ),
|
| 176 |
+
)
|
| 177 |
+
glUseProgram( shader )
|
| 178 |
+
|
| 179 |
+
Note:
|
| 180 |
+
If (and only if) validation of the linked program
|
| 181 |
+
*passes* then the passed-in shader objects will be
|
| 182 |
+
deleted from the GL.
|
| 183 |
+
|
| 184 |
+
returns ShaderProgram() (GLuint) program reference
|
| 185 |
+
raises RuntimeError when a link/validation failure occurs
|
| 186 |
+
"""
|
| 187 |
+
program = glCreateProgram()
|
| 188 |
+
if named.get('separable'):
|
| 189 |
+
glProgramParameteri( program, separate_shader_objects.GL_PROGRAM_SEPARABLE, GL_TRUE )
|
| 190 |
+
if named.get('retrievable'):
|
| 191 |
+
glProgramParameteri( program, get_program_binary.GL_PROGRAM_BINARY_RETRIEVABLE_HINT, GL_TRUE )
|
| 192 |
+
for shader in shaders:
|
| 193 |
+
glAttachShader(program, shader)
|
| 194 |
+
program = ShaderProgram( program )
|
| 195 |
+
glLinkProgram(program)
|
| 196 |
+
program.check_validate()
|
| 197 |
+
program.check_linked()
|
| 198 |
+
for shader in shaders:
|
| 199 |
+
glDeleteShader(shader)
|
| 200 |
+
return program
|
| 201 |
+
def compileShader( source, shaderType ):
|
| 202 |
+
"""Compile shader source of given type
|
| 203 |
+
|
| 204 |
+
source -- GLSL source-code for the shader
|
| 205 |
+
shaderType -- GLenum GL_VERTEX_SHADER, GL_FRAGMENT_SHADER, etc,
|
| 206 |
+
|
| 207 |
+
returns GLuint compiled shader reference
|
| 208 |
+
raises RuntimeError when a compilation failure occurs
|
| 209 |
+
"""
|
| 210 |
+
if isinstance( source, (bytes,unicode)):
|
| 211 |
+
source = [ source ]
|
| 212 |
+
source = [ as_8_bit(s) for s in source ]
|
| 213 |
+
shader = glCreateShader(shaderType)
|
| 214 |
+
glShaderSource( shader, source )
|
| 215 |
+
glCompileShader( shader )
|
| 216 |
+
result = glGetShaderiv( shader, GL_COMPILE_STATUS )
|
| 217 |
+
if not(result):
|
| 218 |
+
# TODO: this will be wrong if the user has
|
| 219 |
+
# disabled traditional unpacking array support.
|
| 220 |
+
raise RuntimeError(
|
| 221 |
+
"""Shader compile failure (%s): %s"""%(
|
| 222 |
+
result,
|
| 223 |
+
glGetShaderInfoLog( shader ),
|
| 224 |
+
),
|
| 225 |
+
source,
|
| 226 |
+
shaderType,
|
| 227 |
+
)
|
| 228 |
+
return shader
|
vllm/lib/python3.10/site-packages/OpenGL/GL/vboimplementation.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from OpenGL.arrays import vbo
|
| 2 |
+
from OpenGL.GL.VERSION import GL_1_5, GL_3_0, GL_3_1
|
| 3 |
+
|
| 4 |
+
class Implementation( vbo.Implementation ):
|
| 5 |
+
"""OpenGL-based implementation of VBO interfaces"""
|
| 6 |
+
def __init__( self ):
|
| 7 |
+
for name in self.EXPORTED_NAMES:
|
| 8 |
+
found = False
|
| 9 |
+
for source in (GL_1_5,GL_3_0, GL_3_1):
|
| 10 |
+
try:
|
| 11 |
+
setattr( self, name, getattr( source, name ))
|
| 12 |
+
except AttributeError as err:
|
| 13 |
+
pass
|
| 14 |
+
else:
|
| 15 |
+
found = True
|
| 16 |
+
break
|
| 17 |
+
assert found, name
|
| 18 |
+
if GL_1_5.glBufferData:
|
| 19 |
+
self.available = True
|
| 20 |
+
|
| 21 |
+
Implementation.register()
|
vllm/lib/python3.10/site-packages/OpenGL/arrays/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (831 Bytes). View file
|
|
|