[Piglit] [PATCH] framework: fix binary assignment for shader_runner
Dylan Baker
dylan at pnwbakers.com
Tue Aug 9 18:15:01 UTC 2016
Quoting Francisco Jerez (2016-08-08 21:56:42)
> Dylan Baker <dylan at pnwbakers.com> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/piglit/attachments/20160809/f61c8046/attachment.sig>
More information about the Piglit
mailing list