Quoting Chad Versace (2017-06-06 15:11:18) > On Tue 06 Jun 2017, Dylan Baker wrote: > > Quoting Chad Versace (2017-06-06 13:36:55) > > > The new function takes a mesa_format and, if the format is an alpha > > > format with a non-alpha variant, returns the non-alpha format. > > > Otherwise, it returns the original format. > > > > > > Example: > > > input -> output > > > > > > // Fallback exists > > > MESA_FORMAT_R8G8B8X8_UNORM -> MESA_FORMAT_R8G8B8A8_UNORM > > > MESA_FORMAT_RGBX_UNORM16 -> MESA_FORMAT_RGBA_UNORM16 > > > > > > // No fallback > > > MESA_FORMAT_R8G8B8A8_UNORM -> MESA_FORMAT_R8G8B8A8_UNORM > > > MESA_FORMAT_Z_FLOAT32 -> MESA_FORMAT_Z_FLOAT32 > > > > > > i965 will use this for EGLImages and DRIimages. > > > --- > > > src/mesa/Android.gen.mk | 12 +++ > > > src/mesa/Makefile.am | 7 ++ > > > src/mesa/Makefile.sources | 2 + > > > src/mesa/main/.gitignore | 1 + > > > src/mesa/main/format_fallback.h | 31 +++++++ > > > src/mesa/main/format_fallback.py | 180 > > > +++++++++++++++++++++++++++++++++++++++ > > > 6 files changed, 233 insertions(+) > > > create mode 100644 src/mesa/main/format_fallback.h > > > create mode 100644 src/mesa/main/format_fallback.py > > [snip] > > > > +def main(): > > > + pargs = parse_args() > > > + > > > + formats = {} > > > + for fmt in format_parser.parse(pargs.csv): > > > + formats[fmt.name] = fmt > > > > You could simplify this as: > > formats = {f.name: f for f in format_parser.parse(pargs.csv)} > > Thanks. I'll do that. > > > > > > + > > > + write_preamble(stdout) > > > + write_func_mesa_format_fallback_rgbx_to_rgba(stdout, formats) > > > > We really shouldn't write to stdout like this, it can cause all kinds of > > breakages if there's ever a UTF-8 character (say ©) and the terminal doesn't > > have a unicode locale it'll fail, > > Ugh. I wasn't aware that Python's stdout was broken. Is Python's > sys.stdout opened in "text" mode, and is that the cause of the > brokenness? > > Does it still fail if stdout is redirected to a file? Because that's the > only case that matters here.
It's not python, it's the shell (I think). In this case it won't be a problem since you don't have any non-ascii characters, but we've run into cases where someone (like me) adds "Copyright © 3001 Mystery Science Theatre" and then breaks some (but not many) systems. I know this because I added such a copyright and broke someone's system, and eventually we narrowed it down to the fact that this person didn't have a UTF-8 locale but I did, we ended up just removing the © character from the output to fix it. > > > if you just open the file you want (say one > > passed as an argument) then it doesn't matter what the console supports. We > > do > > this all over the place so it's not a blocker for me, but I still think > > it's a > > bad idea to write to stdout. > > > If you decide not to change this you at the very least need to call > > stdout.flush() after write_func_mesa_format_fallback_Rgbx_to_rgba.
signature.asc
Description: signature
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev