# Path: src/pegl/ext/khr_sync.py
# class FenceSync(Sync):
#     '''Represents the "fence" type of sync object.
# 
#     Class attributes:
#         extension -- The name string of the fence sync extension.
#         sync_type -- SyncTypes.FENCE.
# 
#     Instance attributes:
#         synchandle, display, status, signaled, sync_type -- As per the
#             superclass, Sync.
#         attribs -- Always an empty AttribList.
#         sync_condition -- The condition under which this sync object
#             will be automatically set to signaled. A value from the
#             SyncConditions tuple.
# 
#     '''
#     extension = 'EGL_KHR_fence_sync'
#     sync_type = SyncTypes.FENCE
# 
#     def __init__(self, display):
#         '''Create the fence sync object.
# 
#         Keyword arguments:
#             display -- As the instance attribute.
# 
#         '''
#         # Fence sync objects have empty attribute lists.
#         super().__init__(display, {})
# 
#     @property
#     def sync_condition(self):
#         '''Get the condition under which this sync object gets signaled.'''
#         return self._attr(SyncAttribs.SYNC_CONDITION)
# 
# class SyncAttribs(Attribs):
#     '''The set of attributes relevant to sync objects.
# 
#     Class attributes:
#         details -- As per the superclass, Attribs.
#         Additionally, symbolic constants for all the known attributes
#         are available as class attributes. Their names are the same as
#         in the extension specification, except without the EGL_ prefix
#         and _KHR suffix.
# 
#     '''
#     # Only for querying; this is not set at creation, but can be toggled later.
#     SYNC_STATUS = 0x30F1
#     # Only for querying; at creation, this is passed as its own parameter.
#     SYNC_TYPE = 0x30F7
#     # As above, plus only valid for fence sync objects.
#     SYNC_CONDITION = 0x30F8
# 
#     details = {SYNC_TYPE: Details('The type of this sync object', c_int, 0),
#                SYNC_STATUS: Details('Which state this sync object is in',
#                                     c_int, SyncStatus.UNSIGNALED),
#                SYNC_CONDITION: Details('Under what condition this sync object '
#                                        'will be automatically signaled', c_int,
#                                        SyncConditions.PRIOR_COMMANDS_COMPLETE)}


from ctypes import c_int, c_int64, POINTER
from .khr_sync import FenceSync, SyncAttribs
# Pegl is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Pegl is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Pegl. If not, see <http://www.gnu.org/licenses/>.

# Standard library imports.

# Local imports.

# New native type. Note that the type EGLAttribKHR is actually defined to be an
# intptr_t, but as that's not supported in ctypes, a 64-bit integer will have
# to suffice. This might break on 128-bit systems(!).
c_wideattr = c_int64
c_wideattr_list = POINTER(c_int64)

# Get handle for the new extension function.
native_createsync = load_ext(b'eglCreateSync64KHR', c_sync,
                             (c_display, c_enum, c_wideattr_list),
                             fail_on=NO_SYNC)

# Subclass SyncAttribs to generate wider native values, and add the new sync
# attribute.

# Path: src/pegl/ext/khr_sync.py
# class FenceSync(Sync):
#     '''Represents the "fence" type of sync object.
# 
#     Class attributes:
#         extension -- The name string of the fence sync extension.
#         sync_type -- SyncTypes.FENCE.
# 
#     Instance attributes:
#         synchandle, display, status, signaled, sync_type -- As per the
#             superclass, Sync.
#         attribs -- Always an empty AttribList.
#         sync_condition -- The condition under which this sync object
#             will be automatically set to signaled. A value from the
#             SyncConditions tuple.
# 
#     '''
#     extension = 'EGL_KHR_fence_sync'
#     sync_type = SyncTypes.FENCE
# 
#     def __init__(self, display):
#         '''Create the fence sync object.
# 
#         Keyword arguments:
#             display -- As the instance attribute.
# 
#         '''
#         # Fence sync objects have empty attribute lists.
#         super().__init__(display, {})
# 
#     @property
#     def sync_condition(self):
#         '''Get the condition under which this sync object gets signaled.'''
#         return self._attr(SyncAttribs.SYNC_CONDITION)
# 
# class SyncAttribs(Attribs):
#     '''The set of attributes relevant to sync objects.
# 
#     Class attributes:
#         details -- As per the superclass, Attribs.
#         Additionally, symbolic constants for all the known attributes
#         are available as class attributes. Their names are the same as
#         in the extension specification, except without the EGL_ prefix
#         and _KHR suffix.
# 
#     '''
#     # Only for querying; this is not set at creation, but can be toggled later.
#     SYNC_STATUS = 0x30F1
#     # Only for querying; at creation, this is passed as its own parameter.
#     SYNC_TYPE = 0x30F7
#     # As above, plus only valid for fence sync objects.
#     SYNC_CONDITION = 0x30F8
# 
#     details = {SYNC_TYPE: Details('The type of this sync object', c_int, 0),
#                SYNC_STATUS: Details('Which state this sync object is in',
#                                     c_int, SyncStatus.UNSIGNALED),
#                SYNC_CONDITION: Details('Under what condition this sync object '
#                                        'will be automatically signaled', c_int,
#                                        SyncConditions.PRIOR_COMMANDS_COMPLETE)}


# Path: src/pegl/ext/khr_clevent2.py
from ctypes import c_int, c_int64, POINTER
from .khr_sync import FenceSync, SyncAttribs

# Pegl is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Pegl is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Pegl. If not, see <http://www.gnu.org/licenses/>.

# Standard library imports.

# Local imports.

# New native type. Note that the type EGLAttribKHR is actually defined to be an
# intptr_t, but as that's not supported in ctypes, a 64-bit integer will have
# to suffice. This might break on 128-bit systems(!).
c_wideattr = c_int64
c_wideattr_list = POINTER(c_int64)

# Get handle for the new extension function.
native_createsync = load_ext(b'eglCreateSync64KHR', c_sync,
                             (c_display, c_enum, c_wideattr_list),
                             fail_on=NO_SYNC)

# Subclass SyncAttribs to generate wider native values, and add the new sync
# attribute.

class WideSyncAttribs(SyncAttribs):