mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 11:18:08 +02:00
st/wgl: Clamp wglChoosePixelFormatARB's output nNumFormats to nMaxFormats.
While running https://github.com/nvMcJohn/apitest with apitrace I noticed that Mesa was producing bogus results: wglChoosePixelFormatARB(hdc, piAttribIList = {...}, pfAttribFList = &0, nMaxFormats = 1, piFormats = {19, 65576, 37, 198656, 131075, 0, 402653184, 0, 0, 0, 0, -573575710}, nNumFormats = &12) = TRUE However https://www.opengl.org/registry/specs/ARB/wgl_pixel_format.txt states <nNumFormats> returns the number of matching formats. The returned value is guaranteed to be no larger than <nMaxFormats>. Cc: "10.2" <mesa-stable@lists.freedesktop.org> Reviewed-by: Brian Paul <brianp@vmware.com>
This commit is contained in:
parent
8d0a1a6bc0
commit
66a1b3a1da
1 changed files with 4 additions and 2 deletions
|
|
@ -448,9 +448,11 @@ wglChoosePixelFormatARB(
|
|||
*/
|
||||
for (i = 0; i < count; i++) {
|
||||
if (scores[i].points > 0) {
|
||||
if (*nNumFormats < nMaxFormats)
|
||||
piFormats[*nNumFormats] = scores[i].index + 1;
|
||||
piFormats[*nNumFormats] = scores[i].index + 1;
|
||||
(*nNumFormats)++;
|
||||
if (*nNumFormats >= nMaxFormats) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue