Age | Commit message (Collapse) | Author | Files | Lines |
|
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>
|
|
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>
|
|
This just saves a bit of typing.
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
This can easily be restored with a revert if it's ever actually needed.
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
This avoids recompiles of the re each time the function is called.
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
|
|
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
|
|
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>
|
|
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>
|
|
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>
|