Browse Source

wgldisplay: Fix HDR framebuffers with newer NVIDIA drivers

[skip ci]
rdb 2 years ago
parent
commit
0a7afb37d9
1 changed files with 6 additions and 0 deletions
  1. 6 0
      panda/src/wgldisplay/wglGraphicsStateGuardian.cxx

+ 6 - 0
panda/src/wgldisplay/wglGraphicsStateGuardian.cxx

@@ -336,6 +336,8 @@ choose_pixel_format(const FrameBufferProperties &properties,
   _supports_pixel_format = has_extension("WGL_ARB_pixel_format");
   _supports_wgl_multisample = has_extension("WGL_ARB_multisample");
 
+  bool supports_pixel_format_float = _supports_pixel_format && has_extension("WGL_ARB_pixel_format_float");
+
   if (has_extension("WGL_ARB_create_context")) {
     _wglCreateContextAttribsARB =
       (PFNWGLCREATECONTEXTATTRIBSARBPROC)wglGetProcAddress("wglCreateContextAttribsARB");
@@ -381,6 +383,10 @@ choose_pixel_format(const FrameBufferProperties &properties,
     iattrib_list[ni++] = WGL_PIXEL_TYPE_ARB;
     iattrib_list[ni++] = WGL_TYPE_RGBA_ARB;
   }
+  else if (supports_pixel_format_float) {
+    iattrib_list[ni++] = WGL_PIXEL_TYPE_ARB;
+    iattrib_list[ni++] = WGL_TYPE_RGBA_FLOAT_ARB;
+  }
 
   if (need_pbuffer) {
     iattrib_list[ni++] = WGL_DRAW_TO_PBUFFER_ARB;