summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2016-03-31glapi: gl_x86-64_asm.py: use _ for unused variablewip/glapi-cleanupDylan Baker1-1/+1
Don't assign variables that aren't actually used, just put them in _, the python unused variable. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-03-31glapi: gl_x86_asm.py: simplify method with sum and generatorDylan Baker1-8/+2
Rather than using a loop, and augmenting a variable use a generator and sum to achieve the same result. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-03-31glapi: glX_server_table.py: use math.log instead of hand coded log2 functionDylan Baker1-10/+2
This just saves a bit of typing. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-03-31glapi: glX_proto_size.py: Remove dead code.Dylan Baker1-76/+1
This code has for a long time returned 0 on entry. This makes the code dead, and the one place it is invoked a no-op if statement (it will always go down the if path). Thanks to version control it's rather simple to restore it if someday someone decides that they want it. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-03-31glapi: glX_proto_send.py: simplify XCB string conversionDylan Baker1-14/+19
This makes the function a little simpler by using a special case for the initial "ARB", and just walking the str as a sequence rather than indexing into it. It also uses a list to join rather than overwritting a str over and over again. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-03-31glapi: glX_proto_send.py: remove useless pass keywordDylan Baker1-1/+0
The pass keyword is the solution for python's whitespace significant code. It's used when something is needed for whitespace rules, but not for programming. Don't add it after actual code. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-03-31glapi: glX_proto_send.py: Don't shadow builtins.Dylan Baker1-7/+7
str is a builtin in python, although python doesn't prevent builtins from being shadowed, its still a bad idea. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-03-31glapi: glX_proto_send.py: don't unpack useless values.Dylan Baker1-5/+5
There are two ways to handle this. One is to use the _ placeholder value when multiple values are needed. The second is to use list indexing to get only the values actually needed when only one value is desired. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-03-31glapi: glX_proto_common.py: use python's _ for unused valuesDylan Baker1-1/+1
Rather than using a variable called junk, use _ for unused unpacked values. This is much more idiomatic. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-03-31glapi: glX_proto_common.py: remove commented out code.Dylan Baker1-1/+0
This can easily be restored with a revert if it's ever actually needed. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-03-31glapi: glX_proto_common.py: return variable from glx_print_proto.size_callDylan Baker1-1/+1
The variable has the same value as the explicit None return, but makes it clearer what's going on. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-03-31glapi: gl_XML.py: return a tuple from gl_parameter.get_dimensionsDylan Baker1-2/+2
rather than a list. In python tuples are mainly for heterogenous collections, especially when position has relevance. Which makes them the right type for the job. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-03-31glapi: gl_XML.py: refactor out extra else statementDylan Baker1-7/+6
This is a pretty minor refactor, but it avoids having an else statement with a nested if. It instead makes it one big if statement. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-03-31glapi: gl_XML.py: add missing method prototype.Dylan Baker1-0/+3
This method is a no-op, but it shuts up tools that get upset that Print calls a non-existent method. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-03-31glapi: gl_XML.py: store compiled re as a module variableDylan Baker1-1/+3
This avoids recompiles of the re each time the function is called. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-03-31glapi: gl_XML.py: avoid unnecessary method callDylan Baker1-2/+1
Don't call and store a value that might not be used unless it's know it's needed. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-03-31glapi: gl_XML.py: simplify is_attr_trueDylan Baker1-7/+5
Use a boolean instead of 0 or 1, and use an assert rather than a runtime error. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-03-31glapi: gl_XML.py: rework gl_api.functionIterateByOffsetDylan Baker1-14/+6
This reworks this method to use the sorted() built-in rather than taking the dictionary keys (which involves creating a brand new copy of the list in memory), sorting it, then iterating the new sorted list and doing a lookup into the dictionary. Then it does away with building a list and returning an iterator over that list, instead using an efficient generator to yield each item one at a time. The resulting function is less code, commented, and should be a little more efficient. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-03-31glapi: gl_XML.py: use collections to simplify functionsIterateByCategoryDylan Baker1-7/+4
This uses the collections.defaultdict to remove the need to check and add an empty dict, since defaultdict will call the default factory for us whenever a KeyError would be raised (by a missing key value). Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-03-31glapi: gl_XML.py: convert gl_api.functionIterateByOffset to a generatorDylan Baker1-8/+6
This implementation is somewhat more efficient than the previous, and is less code. It works by replacing one of the list building functions with a generator, so that the last list can be avoided. It also decreases the size of the list that remains by using sorting instead of a sparse list. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-03-31glapi: gl_XML.py: simplify gl_api.functionIterateByOffsetDylan Baker1-4/+1
Use the max function and a generator expression instead of a loop and if. This is certainly no less efficient, and saves several lines of code. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-03-31glapi: gl_XML.py: make gl_api.categoryIterate a generatorDylan Baker1-8/+5
This does basically the same thing as the previous implementation, although it uses sorted() to act on the dictionary without first copying the keys out into a list, and then indexing back into the dict; and uses yield to make the method a generator, removing the need to make another list. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-03-31glapi: gl_XML.py: remove gl_api.enumIterateByNameDylan Baker1-10/+0
Originally I planned to make it more efficient, but then realized that it wasn't actually used anywhere, so lets just delete it. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-03-31glapi: gl_XML.py: use python's iter() function rather than calling __iter__Dylan Baker1-6/+6
Python has what are often referred to as "magic methods". __iter__, __str__, __add__, and countless more. All of these methods exist to be called by another function or by an operator. The __add__ method implements the + operator, for example. There are times to call the magic methods directly, but usually that's in cases where an implementation needs to call it's parent's method. Instead it's best to use the function or operator that the magic method implements. This makes the code cleaner, more idiomatic, and just a bit nicer to read. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-03-31glapi: replace RuntimeError with asserts or ExceptionDylan Baker4-47/+55
RuntimeError is a very specific type of error. In almost very case it's being raised where an assert is the right choice, and in the rest using a plain Exception is better, at least there it's obvious it's not that the python runtime hit an internal error and died. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-03-31glapi: Use booleans in python code.Dylan Baker7-30/+23
All versions of python that are even worth considering for support (2.6+) have booleans (actually, so do a lot of versions not worth supporting), so don't use 1 and 0 for emulating them, which also helps to clarify the code, since returning an actual value of 1 or 0 happens). Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-03-31glapi: remove useless 0 start parameter for (x)rangeDylan Baker4-10/+10
Python's range and xrange functions start at 0 by default anyway, so don't bother setting it explicitly to 0. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-03-31glapi: use xrange instead of range in pythonDylan Baker4-13/+12
In python 2 range returns a new list, which is okay for very small values, but can get quite expensive for larger lists. xrange on the other hand is an iterator, which requires less memory and processing power. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-03-31glapi: replace deprecated has_key method in pythonDylan Baker7-19/+19
This method (and it's sibling has_* methods) are deprecated in favor of the 'item in container' syntax. There are countless advantages to this for python, but for us this is necessary to get python 3 support. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-03-31glapi: have only one statement per line in python files.Dylan Baker4-11/+20
One line if statements (if foo: break) are pretty uncommon, and are not nearly as readable as their counterparts in other languages. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-03-31glapi: remove superflous parens in pythonDylan Baker4-4/+4
Remove parens that don't do anything. Mostly these are extra grouping parens in if statements, that aren't needed. Unlike C python doesn't require parens around the conditions of if statements, except to group them when using logical operators. It also removes them around the assert keyword. assert is a keyword in python, it doesn't take parens, and accidentally (or purposefully to group) will make the assert not behave in the expected way. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-03-31glapi: Don't use string module in python modulesDylan Baker6-21/+14
Rather than using the string module, use the same method for the str instance (join, split, replace, etc). It's more forward looking, since it will make smoothing over the str/bytes/unicode problem between python 2 and python 3. It's also more standard, using the string module isn't very common. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-03-31glapi: fix singleton comparisons to use 'is' in pythonDylan Baker5-10/+10
Python has two equality comparitors, 'is' and '=='. The difference is that 'is' determines whether instance A *is* instance B, while '==' determines if instance A *has the same value as* instance B. Comparisons with singletons (the notable ones being None, True, and False) should always by done with 'is', basically everything else should always be done with '=='. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-03-31glapi: Fix whitespace in python files.Dylan Baker13-1489/+1488
This removes whitepaces (other than newlines) that are not common in python code, and which are used inconsistently in the code base. Though I prefer PEP8 style, consistency is what really matters (other than mixing tabs and spaces which is bad), so I picked one that I had a tool to check for and picked that one. That means there are no spaces around []'s and ()'s. This patch changes the following: 1) Remove mixing of tabs and spaces for indenting. This is ugly, it never renders right because an editor set up for python expects 4 space indent, but the tabs were inevitably treated as 8 space by the creator. Further, with python3 mixing tabs and spaces will result in a TabError, which halts the interpretor. 2) Remove spaces around brackets and parens. 3) Fix spaces around operators. In signatures there aren't any spaces, but otherwise one space. 4) Enforce 4 space indent, using only spaces to avoid tab errors. This only affects whitespace, and special care has been taken to *not* affect the generated code. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-03-31glapi: remove useless returns from python codeDylan Baker16-136/+1
In python functions return None by default, and it's uncommon to use an explicit return statement without a return value unless it's to return early. It's also uncommon to return None explicitly unless it's an alternate to another possible return value. This patch changes the code to only use returns when they return a real value, or are used for early returns. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-03-31glapi: normalize python newlinesDylan Baker18-251/+7
The python code has no standardization on how many newlines to put anywere. Sometimes top level items have one space between them, sometimes two, and sometimes three. Sometiems methods and other sub items had two, sometimes one, sometimes 3. This patches uses PEP8 styling (2 lines between top level functions and classes, 1 between methods and nested functions), This doesn't result in huge changes in any one file, but when considering all of the python files it's quite a few changes. This is only whitespace changes. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-03-31glapi: use python's textwrap.dedent to make code readableDylan Baker11-459/+502
This allows large blocks of C code that is going to be printed to be nested nicely in the python functions that print them, but still be printed at the same level they were previously. This helps to make the code visually more readable, and fixes syntax folding in vim. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-03-31glapi: remove unnecessary semi-colons in pythonDylan Baker6-24/+24
They don't do anything, they're not required, and they look weird. The only use for semi-colons in python is to put two statements in a single line, which is quite frowned upon by the python community. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-03-31glapi: Update copyright in python files to cover more than IBMDylan Baker18-22/+23
It's a bit odd to call IBM out in particular, especially since Brian Paul is listed as a copyright holder on chronologically before IBM. Either way this should probably have the standard "authors and/or copyright holders", in keeping with the standard MIT license.k Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-03-31glapi: encode python files in utf-8 rather than asciiDylan Baker21-27/+50
This allows, among other things, the proper use of the Copyright symbol in the copyright header (which this patch also does). It cannot be used in the printed templates however, because they are printed, not directly written to a file. If a user doesn't have a UTF-8 locale (or has an operating system that doesn't have UTF-8 support) then that would fail. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-03-31glapi: clean imports in python filesDylan Baker16-25/+45
Completely clean the imports: - Split so that one module is imported per line - Remove unused imports - Group stdlib imports, then 3rd party modules, and finally local modules - sort alphabetically within those groups Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
2016-03-31tgsi: split tgsi_util_get_texture_coord_dim() function into twoBrian Paul6-47/+46
It was kind of overloaded, returning two different things. Now get the index of the shadow reference src register with a new tgsi_util_get_shadow_ref_src_index() function. To verify the new code, I added some temp/debug code which looped over all TGSI_TEXTURE_x values, calling the old function and new and checking that the returned indexes matched. Also tested piglit "shadow" tests with softpipe/llvmpipe. No testing of ilo and radeonsi changes. Reviewed-by: Dave Airlie <airlied@redhat.com>
2016-03-31tgsi: skip texture query opcodes when examining texture targetsBrian Paul1-1/+15
Should fix the assertion in piglit spec@arb_gpu_shader5@texturegather@fs-r-none-shadow-2d when the TXQ instruction specifies a 2D target but the sampler view was declared as SHADOW2D. Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> Tested-by: Michel Dänzer <michel.daenzer@amd.com>
2016-03-31nv50/ir: Check for valid insn instead of def sizePierre Moreau1-2/+2
This fixes a null pointer dereference during the register allocation pass, if a function had arguments. Functions arguments get a definition from the function itself, a definition which is therefore not linked to any instruction. If a value ends up having a definition but no linked instruction, the register allocation pass doesn't need to consider whether that value is generated by an instruction that can only handle "short" registers (on nv50). Signed-off-by: Pierre Moreau <pierre.morrow@free.fr>
2016-03-30mesa: add GL_EXT_copy_image supportIlia Mirkin2-0/+23
The extension is identical to GL_OES_copy_image. But dEQP has tests that want the EXT variant. Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Dave Airlie <airlied@redhat.com>
2016-03-30mesa: add GL_OES_copy_image supportIlia Mirkin8-2/+151
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Dave Airlie <airlied@redhat.com>
2016-03-30mesa: remove duplicate MAX_GEOMETRY_SHADER_INVOCATIONS entryIlia Mirkin1-3/+0
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Dave Airlie <airlied@redhat.com>
2016-03-30st/mesa: add ES sample-shading supportIlia Mirkin2-3/+9
We require the full ARB_gpu_shader5 for now, but in the future some other CAP could get exposed to indicate that only the multisample-related behavior of ARB_gpu_shader5 is available. Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Dave Airlie <airlied@redhat.com>
2016-03-30mesa: add GL_OES_shader_multisample_interpolation supportIlia Mirkin8-10/+28
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2016-03-30mesa: add GL_OES_sample_shading supportIlia Mirkin5-3/+14
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>