home *** CD-ROM | disk | FTP | other *** search
/ Hackers Magazine 57 / CdHackersMagazineNr57.iso / Software / Multimedia / k3d-setup-0.7.11.0.exe / lib / site-packages / OpenGL / raw / GL / APPLE / fence.py < prev    next >
Encoding:
Python Source  |  2008-12-07  |  5.9 KB  |  141 lines

  1. '''OpenGL extension APPLE.fence
  2.  
  3. Overview (from the spec)
  4.     
  5.     This extension is provided a finer granularity of synchronizing GL command
  6.     completion than offered by standard OpenGL, which currently offers only two
  7.     mechanisms for synchronization: Flush and Finish. Since Flush merely assures
  8.     the user that the commands complete in a finite (though undetermined) amount
  9.     of time, it is, thus, of only modest utility.  Finish, on the other hand,
  10.     stalls CPU execution until all pending GL commands have completed forcing
  11.     completely synchronous operation, which most often not the desired result.
  12.     This extension offers a middle ground - the ability to "finish" a subset of
  13.     the command stream, and the ability to determine whether a given command has
  14.     completed or not.
  15.     
  16.     This extension introduces the concept of a "fence" to the OpenGL command
  17.     stream with SetFenceAPPLE.  Once the fence is inserted into the command
  18.     stream, it can be tested for its completion with TestFenceAPPLE. Moreover,
  19.     the application may also request a partial Finish up to a particular "fence"
  20.     using the FinishFenceAPPLE command -- that is, all commands prior to the
  21.     fence will be forced to complete until control is returned to the calling
  22.     process.  These new mechanisms allow for synchronization between the host
  23.     CPU and the GPU, which may be accessing the same resources (typically
  24.     memory).
  25.     
  26.     Fences are created and deleted, as are other objects in OpenGL, specifically
  27.     with GenFencesAPPLE and DeleteFencesAPPLE.  The former returns a list of
  28.     unused fence names and the later deletes the provided list of fence names.
  29.     
  30.     In addition to being able to test or finish a fence this extension allows
  31.     testing for other types of completion, including texture objects, vertex
  32.     array objects, and draw pixels. This allows the client to use
  33.     TestObjectAPPLE or FinishObjectAPPLE with FENCE_APPLE, TEXTURE,
  34.     VERTEX_ARRAY, or DRAW_PIXELS_APPLE with the same type of results as
  35.     TestFenceAPPLE and FinishFenceAPPLE.  Specifically, using the FENCE_APPLE
  36.     type is equivalent to calling TestFenceAPPLE or FinishFenceAPPLE with the
  37.     particular fence name.  Using TEXTURE as the object type tests or waits for
  38.     completion of a specific texture, meaning when there are no pending
  39.     rendering commands which use that texture object. Using the VERTEX_ARRAY
  40.     type will test or wait for drawing commands using that particular vertex
  41.     array object name.  Finally, DRAW_PIXELS_APPLE will wait or test for
  42.     completion of all pending DrawPixels commands.  These tests and finishes
  43.     operate with the same limitations and results as test and finish fence.
  44.     
  45.     One use of this extension is in conjunction with APPLE_vertex_array_range to
  46.     determine when graphics hardware has completed accessing vertex data from a
  47.     vertex array range.  Once a fence has been tested TRUE or finished, all
  48.     vertex indices issued before the fence must have completed being accessed.
  49.     This ensures that the vertex data memory corresponding to the issued vertex
  50.     indices can be safely modified (assuming no other outstanding vertex indices
  51.     are issued subsequent to the fence).
  52.  
  53. The official definition of this extension is available here:
  54.     http://oss.sgi.com/projects/ogl-sample/registry/APPLE/fence.txt
  55.  
  56. Automatically generated by the get_gl_extensions script, do not edit!
  57. '''
  58. from OpenGL import platform, constants, constant, arrays
  59. from OpenGL import extensions
  60. from OpenGL.GL import glget
  61. import ctypes
  62. EXTENSION_NAME = 'GL_APPLE_fence'
  63. GL_DRAW_PIXELS_APPLE = constant.Constant( 'GL_DRAW_PIXELS_APPLE', 0x8A0A )
  64. GL_FENCE_APPLE = constant.Constant( 'GL_FENCE_APPLE', 0x8A0B )
  65. glGenFencesAPPLE = platform.createExtensionFunction( 
  66.     'glGenFencesAPPLE', dll=platform.GL,
  67.     extension=EXTENSION_NAME,
  68.     resultType=None, 
  69.     argTypes=(constants.GLsizei, arrays.GLuintArray,),
  70.     doc = 'glGenFencesAPPLE( GLsizei(n), GLuintArray(fences) ) -> None',
  71.     argNames = ('n', 'fences',),
  72. )
  73.  
  74. glDeleteFencesAPPLE = platform.createExtensionFunction( 
  75.     'glDeleteFencesAPPLE', dll=platform.GL,
  76.     extension=EXTENSION_NAME,
  77.     resultType=None, 
  78.     argTypes=(constants.GLsizei, arrays.GLuintArray,),
  79.     doc = 'glDeleteFencesAPPLE( GLsizei(n), GLuintArray(fences) ) -> None',
  80.     argNames = ('n', 'fences',),
  81. )
  82.  
  83. glSetFenceAPPLE = platform.createExtensionFunction( 
  84.     'glSetFenceAPPLE', dll=platform.GL,
  85.     extension=EXTENSION_NAME,
  86.     resultType=None, 
  87.     argTypes=(constants.GLuint,),
  88.     doc = 'glSetFenceAPPLE( GLuint(fence) ) -> None',
  89.     argNames = ('fence',),
  90. )
  91.  
  92. glIsFenceAPPLE = platform.createExtensionFunction( 
  93.     'glIsFenceAPPLE', dll=platform.GL,
  94.     extension=EXTENSION_NAME,
  95.     resultType=constants.GLboolean, 
  96.     argTypes=(constants.GLuint,),
  97.     doc = 'glIsFenceAPPLE( GLuint(fence) ) -> constants.GLboolean',
  98.     argNames = ('fence',),
  99. )
  100.  
  101. glTestFenceAPPLE = platform.createExtensionFunction( 
  102.     'glTestFenceAPPLE', dll=platform.GL,
  103.     extension=EXTENSION_NAME,
  104.     resultType=constants.GLboolean, 
  105.     argTypes=(constants.GLuint,),
  106.     doc = 'glTestFenceAPPLE( GLuint(fence) ) -> constants.GLboolean',
  107.     argNames = ('fence',),
  108. )
  109.  
  110. glFinishFenceAPPLE = platform.createExtensionFunction( 
  111.     'glFinishFenceAPPLE', dll=platform.GL,
  112.     extension=EXTENSION_NAME,
  113.     resultType=None, 
  114.     argTypes=(constants.GLuint,),
  115.     doc = 'glFinishFenceAPPLE( GLuint(fence) ) -> None',
  116.     argNames = ('fence',),
  117. )
  118.  
  119. glTestObjectAPPLE = platform.createExtensionFunction( 
  120.     'glTestObjectAPPLE', dll=platform.GL,
  121.     extension=EXTENSION_NAME,
  122.     resultType=constants.GLboolean, 
  123.     argTypes=(constants.GLenum, constants.GLuint,),
  124.     doc = 'glTestObjectAPPLE( GLenum(object), GLuint(name) ) -> constants.GLboolean',
  125.     argNames = ('object', 'name',),
  126. )
  127.  
  128. glFinishObjectAPPLE = platform.createExtensionFunction( 
  129.     'glFinishObjectAPPLE', dll=platform.GL,
  130.     extension=EXTENSION_NAME,
  131.     resultType=None, 
  132.     argTypes=(constants.GLenum, constants.GLint,),
  133.     doc = 'glFinishObjectAPPLE( GLenum(object), GLint(name) ) -> None',
  134.     argNames = ('object', 'name',),
  135. )
  136.  
  137.  
  138. def glInitFenceAPPLE():
  139.     '''Return boolean indicating whether this extension is available'''
  140.     return extensions.hasGLExtension( EXTENSION_NAME )
  141.