Bug 103412

Summary: gallium/wgl: Another fix to context creation without prior SetPixelFormat()
Product: Mesa Reporter: frank.richter
Component: OtherAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact: mesa-dev
Severity: normal    
Priority: medium    
Version: 17.2   
Hardware: Other   
OS: Windows (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: patch: Don't blindly use GetPixelFormat() return value

Description frank.richter 2017-10-23 09:49:44 UTC
Created attachment 135000 [details] [review]
patch: Don't blindly use GetPixelFormat() return value

This is a follow-up to bug 101326.

The patch for that bug blindly took the pixel format index returned by GetPixelFormat(). However, what's the guarantee that this pixel format index is actually sensible in the Mesa context, or even a valid index?

Well, none actually. (It's also not an entirely theoretic problem. I received a crash report where an invalid index is indicated, though I couldn't reproduce the exact scenario.)

The attached patch fixes the blind usage of the index by computing the proper Mesa pixel format index from the pixel format description.
Comment 1 Brian Paul 2017-11-10 19:06:52 UTC
Thanks.  Looks good AFAICT.  I'll do a little reformatting and testing before pushing.
Comment 2 Brian Paul 2017-11-15 23:27:41 UTC
Pushed as commit bf41b2b2627aa3790d380092c28c5d3395cc9cde

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.