summaryrefslogtreecommitdiff
path: root/registry
AgeCommit message (Collapse)AuthorFilesLines
2015-03-14registry/gl.py: Fix PEP 8 issues.Vinson Lee1-67/+103
Signed-off-by: Vinson Lee <vlee@freedesktop.org> Reviewed-by: Dylan Baker <baker.dylan.c@gmail.com>
2015-02-23registry generation: Finish hybridizingDylan Baker1-5/+12
registry/gl.py and tests/util/gen_dispatch.py and pretty much indistinguishable in purpose, so it makes sense to finish porting them together. This is actually not very invasive, a few calls to six, and a few cases of using forward compatible functions (functools.reduce instead of the builtin reduce, which was removed in python3) The resulting output is exactly the same. v2: - Use else: assert six.PY3 (jljusten) Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2015-02-23registry/gl.py: add hash methods for classes that need to be hashedDylan Baker1-0/+10
Adds __hash__ methods to a few classes. These aren't particularly unique, but they're good enough for our uses. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2015-02-23registry/gl.py: Don't try to compare None and not-NoneDylan Baker1-3/+3
Python2 allows the comparison of completely unlike types always. Often the rules for these comparisons are surprising. None is one of the most surprising comparisons you can make. In python3 a much more sensible approach was taken, only related types can be compared. So int and float can be compared, but int and None cannot. The solution here is to fail if the value is None, since the comparison expects None to be less than the other value. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2015-02-23registry/gl.py: drop 2.6 supportDylan Baker1-24/+12
We don't support python 2.6 anymore, and since we're trying to hybridize this for 2.7 and 3.3+ this will make our lives much easier, not to mention making the code cleaner and easier to understand. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2015-01-28gen_dispatch.py: remove use of cmp.Dylan Baker1-0/+62
gen_dispatch.py contains a function used to sort Enums, and uses cmp. This patch moves that logic into the Enum class using rich comparison methods instead. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2015-01-28regsitry/gl.py: Make Error class inherit from ExceptionDylan Baker1-1/+1
In python 2 it is expected that errors descend from Exception, but there is no requirement that they do so, in python 3 it is required. This also is problematic because it makes the exception class an old style class, which has all the problems associated with old style classes. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2015-01-28registry/gl.py: remove unused variableDylan Baker1-1/+0
This was spotted by pylint. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2015-01-28registry/gl.py: Strip superfluous parens from the assert keywordDylan Baker1-27/+27
In C assert is a function and requires parens, in python it is a keyword, and doesn't require parens. This might not be that big of a deal, but if you put a comma in those parens then then argument becomes a tuple, which will not do what one intends. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2015-01-28registry/gl.py: Replace __cmp__ methods with rich comparison methodsDylan Baker1-46/+70
In the days of yore python had a single magic method for comparison, __cmp__, which was called with the cmp() function. __cmp__ would return a negative number for less than, 0 for equal, and a positive for greater than. Then in python 2.1 this single method was replace by the "rich comparison methods", __lt__, __gt__, __le__, __ge__, __eq__, and __ne__. These methods provide a more fine grained way to compare objects. Finally, in 2.7 a class decorator was added (functools.total_ordering) which allows one to implement __eq__ and either __lt__ or __gt__, and it fills in the rest. So, why bother? Well, in python 2.1 cmp was deprecated, but in 3.0 it was removed. As we continue to look toward a future that includes python 3 not having features that bind us to python2.ancient is just a good plan. Thanks Chad for looking at this and realizing why my logic was failing. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2015-01-28registry/gl.py: fix no-attribute errorDylan Baker1-1/+1
The Command class defines self.requirements, but not self.__requirements, but the vendor_namespace property checks self.__requirements. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2015-01-28registry/gl.py: remove unused importDylan Baker1-1/+0
Spotted by pylint Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2014-11-11registry: Update gl.xmlLaura Ekstrand2-321/+2327
This replaces the old gl.xml (Revision 26792) with the latest gl.xml from Khronos (Revision 28929, downloaded on 2014-11-10 from https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public). This also updates the python parser, gl.py, to handle command parameters with an array suffix (see uint baseAndCount[2] in glPathGlyphIndexRangeNV, for example). Moreover, gl.py no longer looks for two types of errors in the gl.xml file because the new gl.xml file does not contain these errors. Reviewed-by: Chad Versace <chad.versace@linux.intel.com> Tested-by: Chad Versace <chad.versace@linux.intel.com>
2014-06-27registry/gl: Oops. Disable debug logging by defaultChad Versace1-1/+1
I forgot to disable debug logging before committing ac1f382d. You can manually enable logging with the [-d|--debug] option to the gen_dispatch.py script. Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2014-06-23dispatch: Generate piglit-dispatch from Khronos XMLChad Versace2-0/+1132
Khronos now generates its headers from XML and no longer maintains the old, crufty *.spec files. Piglit should do the same. Otherwise, piglit-dispatch won't be able to pick up new extension functions. As a really really big bonus, after Piglit starts generating its GL dispatch code from gl.xml, it will be a small step to start generating EGL and GLX dispatch from egl.xml and glx.xml. This patch imports 'gl.xml' into a new toplevel "registry" directory, to follow the precedent of libepoxy. This patch follows the precedent of libepoxy by importing "gl.xml" into a new toplevel "registry" directory. I did *not* try to redesign piglit-dispatch in this patch. To the contrary, I attempted to keep the newly generated dispatch code to be as similar as possible as the old generated code. Despite wanting to clean up piglit-dispatch's design, I refrained because "a patch should do one thing, and do it well". I strove to keep separate concerns in separate files. File "registry/gl.py" parses "registry/gl.xml". File "tests/util/gen_dispatch.py" generates code from the that parsed result. This decision kept gen_dispatch.py small and focused. I hope everyone finds the rewritten gen_dispatch.py more maintainable and easy to read. The generated code has changed as following: - It now contains the GLES1 API, because gl.xml contains information on all OpenGL APIs. - The comment block for each function alias set now contains more information. For each function in the set, it now lists the complete set of providers. For example: /* glActiveTexture (GL_VERSION_1_3) (GL_VERSION_ES_CM_1_0) (GL_ES_VERSION_2_0) */ /* glActiveTextureARB (GL_ARB_multitexture) */ extern PFNGLACTIVETEXTUREPROC piglit_dispatch_glActiveTexture; #define glActiveTexture piglit_dispatch_glActiveTexture #define glActiveTextureARB piglit_dispatch_glActiveTexture - Enums are sorted by group then by value. Old dispatch sorted only by value. For example: /* Enum Group MapBufferUsageMask */ #define GL_MAP_READ_BIT 0x0001 #define GL_MAP_READ_BIT_EXT 0x0001 #define GL_MAP_WRITE_BIT 0x0002 #define GL_MAP_WRITE_BIT_EXT 0x0002 ... Tested for regressions with: piglit run -p x11_egl -x glx -x glean Mesa 10.2.1 Intel Ivybridge Fedora 20 v3, for Dylan: - Replace ElementTree with cElementTree, for speed. - Each method $foo in KeyedOrderedSet that returns a generator, rename it to iter${foo} to follow Python2 (not 3) naming conventions. - Python 2.6 lacks OrderedDict, so don't use it. - Remove unused import 'dedent'. - Python 2.6 does not recognize the syntax for set literals, so replace each set literal with a list literal or generator literal. - Replace sys.stderr.write with print(file=sys.stderr). - Remove hand-coded OrderedKeyedSet.copy and instead use copy module. - Prefer the 'lxml' module (it uses libxml2) over Python's builtin 'xml' module. - Replace methods ``def foo(x, y):`` with ``def foo(self, other):``. - Replace lists with generators in methods Command.c_*_param_list. - PEP8: Separate all toplevel items with 2 newlines. - PEP8: Fix minor whitespace issues. - PEP8: Replace some ``== None`` with ``is None``. - Replace None-check for --out-dir with add_argument(..., required=True) - Remove 'prog' assignment when calling ArgumentParser(prog=PROG_NAME). Instead, use default value Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2014-06-23registry: Import gl.xml from Khronos registryChad Versace1-0/+42166
Import revision 26792 on 2014-05-22 from (https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/api/gl.xml). I'm importing the Khronos XML because I want to generate piglit-dispatch code from it rather than scraping GL headers and unmaintained *.spec files. Signed-off-by: Chad Versace <chad.versace@linux.intel.com>