PyOpenGL-accelerate 4.0.0a5__tar.gz → 4.0.0a8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. pyopengl_accelerate-4.0.0a8/MANIFEST.in +25 -0
  2. pyopengl_accelerate-4.0.0a8/OpenGL_accelerate/__init__.py +21 -0
  3. {pyopengl_accelerate-4.0.0a5 → pyopengl_accelerate-4.0.0a8}/PKG-INFO +2 -2
  4. {pyopengl_accelerate-4.0.0a5 → pyopengl_accelerate-4.0.0a8}/PyOpenGL_accelerate.egg-info/PKG-INFO +2 -2
  5. pyopengl_accelerate-4.0.0a8/PyOpenGL_accelerate.egg-info/requires.txt +1 -0
  6. {pyopengl_accelerate-4.0.0a5 → pyopengl_accelerate-4.0.0a8}/pyproject.toml +6 -0
  7. {pyopengl_accelerate-4.0.0a5 → pyopengl_accelerate-4.0.0a8}/setup.py +4 -3
  8. {pyopengl_accelerate-4.0.0a5 → pyopengl_accelerate-4.0.0a8}/src/arraydatatype.pyx +35 -1
  9. {pyopengl_accelerate-4.0.0a5 → pyopengl_accelerate-4.0.0a8}/src/buffers_formathandler.pyx +16 -4
  10. {pyopengl_accelerate-4.0.0a5 → pyopengl_accelerate-4.0.0a8}/src/c/generated/pygl_GL.c +474 -474
  11. {pyopengl_accelerate-4.0.0a5 → pyopengl_accelerate-4.0.0a8}/src/c/generated/pygl_GLES1.c +44 -44
  12. {pyopengl_accelerate-4.0.0a5 → pyopengl_accelerate-4.0.0a8}/src/c/generated/pygl_GLES2.c +119 -119
  13. {pyopengl_accelerate-4.0.0a5 → pyopengl_accelerate-4.0.0a8}/src/c/generated/pygl_GLES3.c +62 -62
  14. {pyopengl_accelerate-4.0.0a5 → pyopengl_accelerate-4.0.0a8}/src/c/generated/pygl_GLSC2.c +14 -14
  15. {pyopengl_accelerate-4.0.0a5 → pyopengl_accelerate-4.0.0a8}/src/c/pygl_runtime.c +131 -25
  16. {pyopengl_accelerate-4.0.0a5 → pyopengl_accelerate-4.0.0a8}/src/wrapper.pyx +16 -4
  17. pyopengl_accelerate-4.0.0a5/MANIFEST.in +0 -4
  18. pyopengl_accelerate-4.0.0a5/OpenGL_accelerate/__init__.py +0 -11
  19. pyopengl_accelerate-4.0.0a5/PyOpenGL_accelerate.egg-info/requires.txt +0 -1
  20. {pyopengl_accelerate-4.0.0a5 → pyopengl_accelerate-4.0.0a8}/OpenGL_accelerate/formathandler.pxd +0 -0
  21. {pyopengl_accelerate-4.0.0a5 → pyopengl_accelerate-4.0.0a8}/OpenGL_accelerate/wrapper.pxd +0 -0
  22. {pyopengl_accelerate-4.0.0a5 → pyopengl_accelerate-4.0.0a8}/PyOpenGL_accelerate.egg-info/SOURCES.txt +0 -0
  23. {pyopengl_accelerate-4.0.0a5 → pyopengl_accelerate-4.0.0a8}/PyOpenGL_accelerate.egg-info/dependency_links.txt +0 -0
  24. {pyopengl_accelerate-4.0.0a5 → pyopengl_accelerate-4.0.0a8}/PyOpenGL_accelerate.egg-info/top_level.txt +0 -0
  25. {pyopengl_accelerate-4.0.0a5 → pyopengl_accelerate-4.0.0a8}/README.md +0 -0
  26. {pyopengl_accelerate-4.0.0a5 → pyopengl_accelerate-4.0.0a8}/license.txt +0 -0
  27. {pyopengl_accelerate-4.0.0a5 → pyopengl_accelerate-4.0.0a8}/setup.cfg +0 -0
  28. {pyopengl_accelerate-4.0.0a5 → pyopengl_accelerate-4.0.0a8}/src/c/generated/pygl_EGL.c +0 -0
  29. {pyopengl_accelerate-4.0.0a5 → pyopengl_accelerate-4.0.0a8}/src/c/generated/pygl_GLX.c +0 -0
  30. {pyopengl_accelerate-4.0.0a5 → pyopengl_accelerate-4.0.0a8}/src/c/generated/pygl_WGL.c +0 -0
  31. {pyopengl_accelerate-4.0.0a5 → pyopengl_accelerate-4.0.0a8}/src/c/generated/pygl_generated.c +0 -0
  32. {pyopengl_accelerate-4.0.0a5 → pyopengl_accelerate-4.0.0a8}/src/c/generated/pygl_modules.c +0 -0
  33. {pyopengl_accelerate-4.0.0a5 → pyopengl_accelerate-4.0.0a8}/src/c/pygl_handwritten.c +0 -0
  34. {pyopengl_accelerate-4.0.0a5 → pyopengl_accelerate-4.0.0a8}/src/errorchecker.pyx +0 -0
  35. {pyopengl_accelerate-4.0.0a5 → pyopengl_accelerate-4.0.0a8}/src/formathandler.pyx +0 -0
  36. {pyopengl_accelerate-4.0.0a5 → pyopengl_accelerate-4.0.0a8}/src/latebind.pyx +0 -0
  37. {pyopengl_accelerate-4.0.0a5 → pyopengl_accelerate-4.0.0a8}/src/nones_formathandler.pyx +0 -0
  38. {pyopengl_accelerate-4.0.0a5 → pyopengl_accelerate-4.0.0a8}/src/numpy_formathandler.pyx +0 -0
  39. {pyopengl_accelerate-4.0.0a5 → pyopengl_accelerate-4.0.0a8}/src/vbo.pyx +0 -0
  40. {pyopengl_accelerate-4.0.0a5 → pyopengl_accelerate-4.0.0a8}/tests/test_arraydatatypeaccel.py +0 -0
  41. {pyopengl_accelerate-4.0.0a5 → pyopengl_accelerate-4.0.0a8}/tests/test_numpyaccel.py +0 -0
@@ -0,0 +1,25 @@
1
+ # The sources an install builds from.
2
+ include src/*.pyx
3
+ include OpenGL_accelerate/*.pxd
4
+ include license.txt
5
+
6
+ # `exclude`, not merely "not included": setuptools puts every extension
7
+ # `sources` entry into the archive by itself, and `cythonize` rewrites those
8
+ # entries from the .pyx to the .c it generated. So the C arrives without
9
+ # anything here asking for it, and has to be taken back out.
10
+ exclude src/*.c
11
+
12
+ # NOT `include src/*.c`: that is Cython's output from the .pyx beside it, and
13
+ # Cython is a hard build requirement of this package (see [build-system]), so
14
+ # every install from this archive writes that C itself. `setup.py`'s
15
+ # `drop_c_from_another_toolchain` deletes any that arrived, because the
16
+ # archive carries no toolchain stamp for it to match against -- so shipping it
17
+ # is weight that is deleted on arrival, with a hazard attached: stale
18
+ # generated C is what fails to compile against a numpy it was not written for,
19
+ # reporting an error inside a numpy header that names nothing in this package.
20
+ # See https://github.com/mcfletch/pyopengl/issues/121
21
+ #
22
+ # `src/c/**` is a different thing and is shipped: the dispatch layer generated
23
+ # from the Khronos registry by a tool that does not run at install time and is
24
+ # not distributed. setup.py names those as extension sources, which is what
25
+ # puts them in the archive.
@@ -0,0 +1,21 @@
1
+ """Cython-coded accelerators for the PyOpenGL wrapper
2
+
3
+ This package contains Cython accelerator modules which
4
+ attempt to speed up certain aspects of the PyOpenGL 3.x
5
+ wrapper mechanism. The source code is part of the
6
+ PyOpenGL package and is built via the setupaccel.py
7
+ script in the top level of the PyOpenGL source package.
8
+ """
9
+
10
+ import re as _re
11
+
12
+ #: The version this was built as, which is also the PyOpenGL it pairs with:
13
+ #: the two share generated tables, the dependency is pinned to this number,
14
+ #: and the extension refuses a PyOpenGL stating another. A release bumps
15
+ #: both this and ``OpenGL/version.py``.
16
+ __version__ = "4.0.0a8"
17
+ #: The numeric release ``__version__`` names, without a pre-release marker,
18
+ #: which ``OpenGL.acceleratesupport`` compares with its floor.
19
+ __version_tuple__ = tuple(
20
+ int(part) for part in _re.match(r'(\d+)\.(\d+)\.(\d+)', __version__).groups()
21
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyOpenGL-accelerate
3
- Version: 4.0.0a5
3
+ Version: 4.0.0a8
4
4
  Summary: Cython-coded accelerators for PyOpenGL
5
5
  Home-page: http://pyopengl.sourceforge.net
6
6
  Download-URL: http://sourceforge.net/project/showfiles.php?group_id=5988
@@ -24,7 +24,7 @@ Classifier: Intended Audience :: Developers
24
24
  Requires-Python: >=3.9
25
25
  Description-Content-Type: text/markdown
26
26
  License-File: license.txt
27
- Requires-Dist: PyOpenGL==4.0.0a5
27
+ Requires-Dist: PyOpenGL==4.0.0a8
28
28
  Dynamic: download-url
29
29
  Dynamic: license-file
30
30
  Dynamic: requires-dist
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyOpenGL-accelerate
3
- Version: 4.0.0a5
3
+ Version: 4.0.0a8
4
4
  Summary: Cython-coded accelerators for PyOpenGL
5
5
  Home-page: http://pyopengl.sourceforge.net
6
6
  Download-URL: http://sourceforge.net/project/showfiles.php?group_id=5988
@@ -24,7 +24,7 @@ Classifier: Intended Audience :: Developers
24
24
  Requires-Python: >=3.9
25
25
  Description-Content-Type: text/markdown
26
26
  License-File: license.txt
27
- Requires-Dist: PyOpenGL==4.0.0a5
27
+ Requires-Dist: PyOpenGL==4.0.0a8
28
28
  Dynamic: download-url
29
29
  Dynamic: license-file
30
30
  Dynamic: requires-dist
@@ -0,0 +1 @@
1
+ PyOpenGL==4.0.0a8
@@ -70,3 +70,9 @@ cache-keys = [
70
70
  { file = "setup.py" },
71
71
  { file = "OpenGL_accelerate/__init__.py" },
72
72
  ]
73
+
74
+ [tool.openglcontext-checks]
75
+ # The OGC rules (openglcontext-checks) this project is held to by the
76
+ # workspace preflight: every rule there is, each named, so a rule added
77
+ # later joins when the project is clean of it.
78
+ select = ["OGC121", "OGC131", "OGC141", "OGC161", "OGC201", "OGC221", "OGC222", "OGC223"]
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env python
2
2
  """Builds accelleration functions for PyOpenGL
3
3
  """
4
- import sys
5
4
  from setuptools import setup, Extension
6
5
 
7
6
  try:
@@ -84,8 +83,9 @@ def write_version_header():
84
83
  except OSError:
85
84
  pass
86
85
  os.makedirs(os.path.dirname(path), exist_ok=True)
87
- with open(path, 'w', encoding='utf-8') as handle:
86
+ with open(path + '.partial', 'w', encoding='utf-8') as handle:
88
87
  handle.write(contents)
88
+ os.replace(path + '.partial', path)
89
89
  return VERSION_HEADER
90
90
 
91
91
 
@@ -203,8 +203,9 @@ def drop_c_from_another_toolchain():
203
203
  pass
204
204
  for path in glob.glob(os.path.join(HERE, 'src', '*.c')):
205
205
  os.unlink(path)
206
- with open(TOOLCHAIN_STAMP, 'w', encoding='utf-8') as handle:
206
+ with open(TOOLCHAIN_STAMP + '.partial', 'w', encoding='utf-8') as handle:
207
207
  handle.write(wanted)
208
+ os.replace(TOOLCHAIN_STAMP + '.partial', TOOLCHAIN_STAMP)
208
209
 
209
210
 
210
211
  def cython_extension(
@@ -28,9 +28,35 @@ cdef class HandlerRegistry:
28
28
  self.all_output_handlers = []
29
29
  def __setitem__( self,key,value ):
30
30
  self.registry[key] = value
31
+ # The pure-Python HandlerRegistry is a dict subclass, so it answers a
32
+ # lookup by type as well as a lookup by value. This one held its mapping
33
+ # privately and offered only __setitem__, so `FormatHandler.typeLookup`
34
+ # -- a public classmethod, and how a third party asks which handler its
35
+ # own array format resolved to -- raised
36
+ # TypeError: 'HandlerRegistry' object is not subscriptable
37
+ # wherever the accelerators are installed, which is most installations.
38
+ # Its `except KeyError` could not catch that, so the caller got an error
39
+ # about the registry's type rather than the answer or the KeyError the
40
+ # method documents.
41
+ def __getitem__( self, key ):
42
+ return self.registry[key]
43
+ def __contains__( self, key ):
44
+ return key in self.registry
45
+ def __len__( self ):
46
+ return len( self.registry )
47
+ def __iter__( self ):
48
+ return iter( self.registry )
49
+ def get( self, key, default=None ):
50
+ return self.registry.get( key, default )
51
+ def keys( self ):
52
+ return self.registry.keys()
53
+ def values( self ):
54
+ return self.registry.values()
55
+ def items( self ):
56
+ return self.registry.items()
31
57
  def __call__( self, value ):
32
58
  return self.c_lookup( value )
33
-
59
+
34
60
  cdef object c_lookup( self, object value ):
35
61
  """C-level lookup of handler for given value"""
36
62
  cdef object typ, handler,base
@@ -491,6 +517,14 @@ cdef class AsArrayOfType(pyArgConverter):
491
517
  self.typeIndex = wrapper.pyArgIndex( self.typeName )
492
518
  cdef object c_call( self, object incoming, object function, tuple arguments ):
493
519
  """Get the arg as an array of the appropriate type"""
520
+ # An integer is a byte offset into the bound buffer rather than one
521
+ # datum to upload: this converter serves glDrawElements and the pixel
522
+ # calls, whose data argument the GL reads as an offset whenever a
523
+ # buffer object is bound. Kept in step with the ctypes converter of
524
+ # the same name in OpenGL/arrays/arrayhelpers.py, and with
525
+ # OpenGL.arrays.arraydatatype.buffer_offset, which decides.
526
+ if type(incoming) is int:
527
+ return ctypes.c_void_p( incoming )
494
528
  return self.arrayType.asArray( incoming, arguments[ self.typeIndex ] )
495
529
 
496
530
  cdef class AsArrayTyped(pyArgConverter):
@@ -91,7 +91,13 @@ cdef class MemoryviewHandler(FormatHandler):
91
91
  cdef c_arraySize( self, object instance, object typeCode ):
92
92
  """Retrieve array size reference"""
93
93
  cdef Py_buffer * buffer
94
- buffer = PyMemoryView_GET_BUFFER( self.c_as_memoryview( instance ) )
94
+ # `view` holds the memoryview for as long as `buffer` points into it.
95
+ # `c_as_memoryview` builds one where the instance is not already a
96
+ # memoryview, and a temporary of it lives only to the end of the
97
+ # statement that made it -- so reading through `buffer` on the next
98
+ # line reads a Py_buffer inside a freed object.
99
+ view = self.c_as_memoryview( instance )
100
+ buffer = PyMemoryView_GET_BUFFER( view )
95
101
  return buffer.len//buffer.itemsize
96
102
  cdef c_arrayByteCount( self, object instance ):
97
103
  """Given a data-value, calculate number of bytes required to represent"""
@@ -100,7 +106,9 @@ cdef class MemoryviewHandler(FormatHandler):
100
106
  cdef c_arrayToGLType( self, object instance ):
101
107
  """Given a value, guess OpenGL type of the corresponding pointer"""
102
108
  cdef Py_buffer * buffer
103
- buffer = PyMemoryView_GET_BUFFER( self.c_as_memoryview( instance ) )
109
+ # `view` keeps the memoryview alive; see `c_arraySize`.
110
+ view = self.c_as_memoryview( instance )
111
+ buffer = PyMemoryView_GET_BUFFER( view )
104
112
  cdef object constant = self.array_to_gl_constant.get( buffer.format )
105
113
  if constant is None:
106
114
  if isinstance(buffer.format,bytes):
@@ -133,10 +141,14 @@ cdef class MemoryviewHandler(FormatHandler):
133
141
  cdef c_dimensions( self, object instance ):
134
142
  """Retrieve full set of dimensions for the array as tuple"""
135
143
  cdef Py_buffer * buffer
136
- buffer = PyMemoryView_GET_BUFFER( self.c_as_memoryview( instance ) )
144
+ # `view` keeps the memoryview alive; see `c_arraySize`.
145
+ view = self.c_as_memoryview( instance )
146
+ buffer = PyMemoryView_GET_BUFFER( view )
137
147
  cdef dim = 0
138
148
  cdef list result
139
149
  result = []
140
150
  for dim in range(buffer.ndim):
141
151
  result.append( buffer.shape[dim] )
142
- return result
152
+ # A tuple, as the shape of an array is everywhere else here and as
153
+ # `OpenGL.arrays.buffers.BufferHandler.dimensions` answers.
154
+ return tuple( result )