summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorMichael Pohoreski <ptolemy@lindenlab.com>2021-01-26 00:00:13 +0000
committerMichael Pohoreski <ptolemy@lindenlab.com>2021-01-26 00:00:13 +0000
commit25186d07acdeb3ba079594f8f0f8677626b1baf6 (patch)
tree9f644bc72d4f98f2c8d6d60fe096fd9461deef1e /indra
parentf639747fad3c96f2a0ebcff4903ebaaf04fa4fe7 (diff)
parenta1107d0e17565f341e64de5e2e209ce0127cb0bc (diff)
Merged in SL-14705 (pull request #445)
SL-14705: Merge Sovereign Engineer's fix for name tags showing in front with AMD GPUs: Fix GL_INVALID_OPERATION when copying stencil to default window framebuffer on AMD graphics on windows Approved-by: Dave Houlton
Diffstat (limited to 'indra')
-rw-r--r--indra/llwindow/llwindowwin32.cpp30
1 files changed, 18 insertions, 12 deletions
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp
index 6831071cd1..afe0c2cc6a 100644
--- a/indra/llwindow/llwindowwin32.cpp
+++ b/indra/llwindow/llwindowwin32.cpp
@@ -1474,24 +1474,30 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
LL_INFOS("Window") << "pixel formats done." << LL_ENDL ;
- S32 swap_method = 0;
- S32 cur_format = num_formats-1;
- GLint swap_query = WGL_SWAP_METHOD_ARB;
-
- BOOL found_format = FALSE;
-
- while (!found_format && wglGetPixelFormatAttribivARB(mhDC, pixel_format, 0, 1, &swap_query, &swap_method))
+ S32 swap_method = 0;
+ S32 cur_format = 0;
+const S32 max_format = (S32)num_formats - 1;
+ GLint swap_query = WGL_SWAP_METHOD_ARB;
+
+ // SL-14705 Fix name tags showing in front of objects with AMD GPUs.
+ // On AMD hardware we need to iterate from the first pixel format to the end.
+ // Spec:
+ // https://www.khronos.org/registry/OpenGL/extensions/ARB/WGL_ARB_pixel_format.txt
+ while (wglGetPixelFormatAttribivARB(mhDC, pixel_formats[cur_format], 0, 1, &swap_query, &swap_method))
{
- if (swap_method == WGL_SWAP_UNDEFINED_ARB || cur_format <= 0)
+ if (swap_method == WGL_SWAP_UNDEFINED_ARB)
{
- found_format = TRUE;
+ break;
}
- else
+ else if (cur_format >= max_format)
{
- --cur_format;
+ cur_format = 0;
+ break;
}
+
+ ++cur_format;
}
-
+
pixel_format = pixel_formats[cur_format];
if (mhDC != 0) // Does The Window Have A Device Context?