# 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
from .khr_sync import FenceSync, SyncAttribs
class OpenCLSync(FenceSync):
    '''A sync object for waiting on an OpenCL event.

    Class attributes:
        extension -- The name string of the OpenCL event sync extension.
        sync_type -- The value 0x30FE, represented by the symbolic name
            SYNC_CL_EVENT.

    Instance attributes:
        synchandle, display, status, signaled, sync_type -- As per the
            superclass, FenceSync.
        attribs -- Contains one attribute, namely the OpenCL event
            handle (attribute SyncAttribs.CL_EVENT_HANDLE).
        sync_condition -- The condition under which this sync object
            will be automatically set to signaled. Should always be the
            value SYNC_CL_EVENT_COMPLETE.

    '''
    extension = 'EGL_KHR_cl_event'
    sync_type = SYNC_CL_EVENT

    def __init__(self, display, cl_event):
        '''Create the fence sync object.

        Keyword arguments:
            display -- As the instance attribute.
            cl_event -- The native handle for an OpenCL event.

        '''
        # OpenCL event sync objects have one attribute, an OpenCL event handle.

# 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_clevent.py
from ctypes import c_int
from .khr_sync import FenceSync, SyncAttribs

class OpenCLSync(FenceSync):
    '''A sync object for waiting on an OpenCL event.

    Class attributes:
        extension -- The name string of the OpenCL event sync extension.
        sync_type -- The value 0x30FE, represented by the symbolic name
            SYNC_CL_EVENT.

    Instance attributes:
        synchandle, display, status, signaled, sync_type -- As per the
            superclass, FenceSync.
        attribs -- Contains one attribute, namely the OpenCL event
            handle (attribute SyncAttribs.CL_EVENT_HANDLE).
        sync_condition -- The condition under which this sync object
            will be automatically set to signaled. Should always be the
            value SYNC_CL_EVENT_COMPLETE.

    '''
    extension = 'EGL_KHR_cl_event'
    sync_type = SYNC_CL_EVENT

    def __init__(self, display, cl_event):
        '''Create the fence sync object.

        Keyword arguments:
            display -- As the instance attribute.
            cl_event -- The native handle for an OpenCL event.

        '''
        # OpenCL event sync objects have one attribute, an OpenCL event handle.

        super().__init__(display, {SyncAttribs.CL_EVENT_HANDLE: cl_event})