Quoting Francisco Jerez (2016-08-08 21:56:42) > Dylan Baker <[email protected]> writes: > > +class _SelectProg(object): > > + """A class for selecting the correct program. > > + > > + This is implemented as a class with a call method to avoid having to > > + reinitialize the _find as a function, or placing it in the global > > + namspace. > > + """ > > + # This is sort of the python equivalent of a case statement. > > + _find = { > > + # pylint: disable=bad-whitespace > > + ('<=', 2.0): 'shader_runner_gles2', > > + ('=', 2.0): 'shader_runner_gles2', > > + ('>=', 2.0): 'shader_runner_gles2', > > + ('>', 2.0): 'shader_runner_gles3', > > + > > + ('<', 3.0): 'shader_runner_gles2', > > + ('<=', 3.0): 'shader_runner_gles2', > > + ('=', 3.0): 'shader_runner_gles3', > > + ('>=', 3.0): 'shader_runner_gles3', > > + ('>', 3.0): 'shader_runner_gles3', > > + > > + ('<', 3.1): 'shader_runner_gles2', > > + ('<=', 3.1): 'shader_runner_gles2', > > + ('=', 3.1): 'shader_runner_gles3', > > + ('>=', 3.1): 'shader_runner_gles3', > > + ('>', 3.1): 'shader_runner_gles3', > > + > > + ('<', 3.2): 'shader_runner_gles2', > > + ('<=', 3.2): 'shader_runner_gles2', > > + ('=', 3.2): 'shader_runner_gles3', > > + ('>=', 3.2): 'shader_runner_gles3', > > Hm... Wouldn't it be easier to do this algorithmically rather than > trying to enumerate every possible combination of comparison operator > and GLES version? If anything it would save us from having to come back > to fix this the next time a GLES version is released. Maybe something > along the lines of: > > | 'shader_runner_gles2' if op in ['<', '<='] or > | op in ['=', '>', '>='] and version < 3 > | else 'shader_runner_gles3' > > IOW, use shader_runner_gles2 if the version requirement intersects the > x < 3 half-line, otherwise use shader_runner_gles3. >
Yes, and I was trying to come up with such an algorithm, but I couldn't come up with anything that was less complicated than the match-like statement. I'll make this change and spin a v2. Dylan
signature.asc
Description: signature
_______________________________________________ Piglit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/piglit
