Explorar el Código

Add a note that OpenVR overlays assume unpremultiplied alpha by default

Sam Lantinga hace 4 días
padre
commit
87e3250518
Se han modificado 1 ficheros con 8 adiciones y 0 borrados
  1. 8 0
      src/video/openvr/SDL_openvrvideo.c

+ 8 - 0
src/video/openvr/SDL_openvrvideo.c

@@ -654,6 +654,14 @@ static bool OPENVR_InitializeOverlay(SDL_VideoDevice *_this,SDL_Window *window)
     videodata->oOverlay->SetOverlayFlag(videodata->overlayID, 1<<23, true); //vr::VROverlayFlags_EnableControlBar
     videodata->oOverlay->SetOverlayFlag(videodata->overlayID, 1<<24, true); //vr::VROverlayFlags_EnableControlBarKeyboard
     videodata->oOverlay->SetOverlayFlag(videodata->overlayID, 1<<25, true); //vr::VROverlayFlags_EnableControlBarClose
+#if 0
+    /* OpenVR overlays assume unpremultiplied alpha by default, set this flag to tag the source buffer as premultiplied.
+     * Note that (as of 2025) OpenVR overlay composition is higher quality when premultiplied buffers are provided,
+     * as texture samplers that blend energy (such as bilinear) do not yield sensical results when operating on natively
+     * unpremultiplied textures. It is thus preferable to hand openvr natively premultiplied buffers when accurate
+     * sampling / composition is required. */
+    videodata->oOverlay->SetOverlayFlag(videodata->overlayID, VROverlayFlags_IsPremultiplied, true );
+#endif
     videodata->oOverlay->SetOverlayName(videodata->overlayID, window->title);
 
     videodata->bDidCreateOverlay = true;