Compare commits

...

2 Commits

Author SHA1 Message Date
b8b511dd27
Add | add lto=yes to nuitka_build
just incase
2023-10-19 00:16:57 +08:00
eedaa3e370
sync pyglet 2023-10-18 21:16:47 +08:00
2 changed files with 11 additions and 4 deletions

View File

@ -55,10 +55,11 @@ def draw(size, mode, **data):
assert size == len(array) // attribute.count, 'Data for %s is incorrect length' % fmt assert size == len(array) // attribute.count, 'Data for %s is incorrect length' % fmt
buffer = BufferObject(size * attribute.stride) buffer = BufferObject(size * attribute.stride)
attribute.set_region(buffer, 0, size, array) data = (attribute.c_type * len(array))(*array)
buffer.set_data(data)
attribute.enable() attribute.enable()
attribute.set_pointer(buffer.ptr) attribute.set_pointer(buffer.ptr)
buffers.append(buffer) # Don't garbage collect it. buffers.append(buffer) # Don't garbage collect it.
glDrawArrays(mode, 0, size) glDrawArrays(mode, 0, size)
@ -108,10 +109,12 @@ def draw_indexed(size, mode, indices, **data):
assert size == len(array) // attribute.count, 'Data for %s is incorrect length' % fmt assert size == len(array) // attribute.count, 'Data for %s is incorrect length' % fmt
buffer = BufferObject(size * attribute.stride) buffer = BufferObject(size * attribute.stride)
attribute.set_region(buffer, 0, size, array) data = (attribute.c_type * len(array))(*array)
buffer.set_data(data)
attribute.enable() attribute.enable()
attribute.set_pointer(buffer.ptr) attribute.set_pointer(buffer.ptr)
buffers.append(buffer) buffers.append(buffer) # Don't garbage collect it.
if size <= 0xff: if size <= 0xff:
index_type = GL_UNSIGNED_BYTE index_type = GL_UNSIGNED_BYTE

View File

@ -55,6 +55,10 @@ if __name__ == '__main__':
compiler.output_path = Path(out_path) compiler.output_path = Path(out_path)
sys.argv.remove('--output') sys.argv.remove('--output')
sys.argv.remove(out_path) sys.argv.remove(out_path)
if '--lto=yes' in sys.argv:
compiler.use_lto = True
sys.argv.remove('--lto=yes')
# 检测 --no-pyglet-opt 参数 # 检测 --no-pyglet-opt 参数
pyglet_optimizations = True pyglet_optimizations = True